I'm getting starting 'antd' which is a react ui library, with my react project.
The problem was to change the background color of antd's Header component. (white -> red)

The first thing I tried was to give a new className to the Header component and change the background color.
enter image description here enter image description here
But it didn't work.

The next thing I tried was to override the style using the className set by antd.
enter image description here
It didn't work either.

How can I change the style of this Header component?
I am not using the css methodology such as styled-components or css-module, and I do not want to use the 'important!' property, or inline styling.

推荐答案

您可以增加css的专用性.示例:div.my-class

Css相关问答推荐

当optgroup元素不包含任何未使用CSS禁用的选项元素时,如何隐藏它

无法瞄准元素

添加Angular 17的Stackblitz项目的Angular material 主题?

此css Select 器的总体特性是什么?按钮:不是(#mainBtn,.cta)

在css网格中用一个锚标签(顶部/底部边距)包装图像?

使用最小高度和边框使阴影DOM中的元素达到自定义元素高度的100%,如果溢出,还可以zoom 父元素

如果 css 仅位于 razor 页面中的一页上,我是否仍应在 wwwroot 中写入或仅将其放在页面上?

是否可以在元素之间对齐渐变?

禁用MUI DataGrid上的悬停效果

使用 flexbox 使图像与内容高度相同

使用 mixin 在 SCSS 中进行媒体查询

停止 div 推动另一个 div 做出react

关键帧不能动画回来

在同一旋转中以度数变换旋转

选中时从 HTML 文本输入中移除蓝色光晕

纯 CSS 滚动动画

使用 :focus 设置外部 div 的样式?

CSS:悬停一个元素,多个元素的效果?

HTML5 和边框

如何在 CSS 中给出背景图像路径?