The ! important directive overrides the normal rules of the cascade and it gives that style very high specificity.
How is cascading property maintained in CSS?
In CSS, styles sheets cascade by order of importance. If rules in different style sheets conflict with one another, the rule from the most important style sheet wins. Below is a list of possible sources of a CSS rule. They are listed by order of importance.
How do you override CSS styles?
instead of overwriting, create it as different css and call it in your element as other css(multiple css).
...
There are three ways of achieving this that I can think of.
...
There are three ways of achieving this that I can think of.
- Add inline styles to the elements.
- create and append a new <style> element, and add the text to override this style to it.
- Modify the css rule itself.