覆盖antd组件样式/className



我正在尝试更新一个antd组件样式。我使用的是:https://pro.ant.design/docs/style#override-组件样式作为参考,尝试更新组件样式,但我无法使其工作。

以下是我正在尝试的内容:https://codesandbox.io/s/cool-wind-kkub0?file=/index.less我不明白我错过了什么。有什么建议吗?

您正在使用作用域样式,这是通过弹出应用程序或安装用于加载样式组件样式的npm包来实现的。要做到这一点,请将.less代码粘贴到index.css文件中

index.css

.ant-select-selection {
max-height: 51px;
overflow: auto;
background-color: blue;
}
.ant-select-selection-search-input {
background-color: green;
}
.ant-select-item-option-content {
background-color: orange;
}
.ant-select-item {
position: relative;
display: block;
min-height: 32px;
padding: 5px 12px;
color: red;
font-weight: normal;
font-size: 14px;
line-height: 22px;
cursor: pointer;
-webkit-transition: background 0.3s ease;
transition: background 0.3s ease;
background-color: #9068b0;
}

最新更新