简体   繁体   English

如何设置 Antd Divider 颜色

[英]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基本上将此添加到自定义 css 作品

.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 class 来覆盖分隔器的颜色,它应该像

.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.borderLeft这样的属性应该可以正常工作。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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