![](/img/trans.png)
[英]How to use antd divider to separate two sides of the screen in a react component?
[英]How to set Antd Divider colour
我试过设置样式颜色、背景颜色和边框颜色。 所有不工作的分隔线仍然使用默认颜色。 有小费吗?
import {Divider } from "antd";
<Divider style={{ color: "#d8d8d8" }}>or</Divider>
<Divider style={{ backgroundColor: "#d8d8d8" }}>or</Divider>
<Divider style={{ borderColor: "#d8d8d8" }}>or</Divider>
基本上将此添加到自定义 css 作品
.ant-divider-horizontal.ant-divider-with-text-center::before,
.ant-divider-horizontal.ant-divider-with-text-center::after
{
border-top: 1px solid red;
}
您需要使用ant-divider
class 来覆盖分隔器的颜色,它应该像
.ant-divider{
background-color: red;
}
或者你可以像这样使用它
<Divider style={{'background-color':'blue'}}/>
请在此处查看工作示例演示
您可以将样式应用于分隔符组件。 像borderLeft
这样的属性应该可以正常工作。
<Divider style={{ borderLeft: '1px solid red' }} />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.