Home > Back-end >  I cannot override the style of components from react ui library
I cannot override the style of components from react ui library

Time:10-12

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.

CodePudding user response:

You can increase CSS specificity. Example: div.my-class

  • Related