简体   繁体   中英

How to set Antd Divider colour

I've tried setting the style colour, background colour, and border colour. All not working the divider still using the default colour. Any tips?

import {Divider } from "antd";

<Divider style={{ color: "#d8d8d8" }}>or</Divider>
<Divider style={{ backgroundColor: "#d8d8d8" }}>or</Divider>
<Divider style={{ borderColor: "#d8d8d8" }}>or</Divider>

basically adding this to custom css works

.ant-divider-horizontal.ant-divider-with-text-center::before,
.ant-divider-horizontal.ant-divider-with-text-center::after
{
   border-top: 1px solid red;
}

You need to use the ant-divider class to override the color for a divider and it should be like

.ant-divider{
  background-color: red;
}

or you can use it like

<Divider style={{'background-color':'blue'}}/>

please check here working example Demo

You can apply styling to the divider component. Property like borderLeft should work fine.

<Divider style={{ borderLeft: '1px solid red' }} />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM