Sun Dial Menu
CSS Important
Menu CSS Important
 

The CSS !important rule

In my "journey" into the world of CSS I came across the "!important" concept. Like a lot of other things I chanced upon this when looking at other things.

There seems to a mixed view on whether that this is a good or a bad thing. Some IT departments actually ban its use. The reason being is that it creates a level of confusion if code needs to be debugged and that it is "lazy" programming.

However, the use of the !important is used extensively in the W3.css framework. Specifically the colours are defined in such a way that there is an over-ride. In my case I wanted to over-over-ride the w3-sand colour as I was told that it wa "too pink".

For example, I changed the background colour on this page to w3-pale-red (pink) by changing the class of the "main" container from w3-sand to w3-pale-red

Top

The W3 Schools website says:

The !important rule in CSS is used to add more importance to a property/value than normal.

In fact, if you use the !important rule, it will override ALL previous styling rules for that specific property on that element!

Links

Site design by Tempusfugit Web Design -