Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I "stack" !important;?

Tags:

css

I googled a little bit and I couldn't find the answer.

My question is: does stacking !important works in some way? Or can I achieve the same functionality in another way? I'm aware that it's not a good practice

Example, say I have:

.myOuterDiv
{
   margin-left: 5px !important; 
}

.myInnerDiv
{
   margin-left: 10px !important; 
}

It's obvious that the content of the inner div will have a margin of 10px, but can I add another important such as

.myOuterDiv
{
   margin-left: 5px !important !important; 
}

I wanna do exactly that, override the inner important so I can have a margin-left of 10. Can I do it like this or in some other way?

like image 295
Gaspa79 Avatar asked Oct 11 '13 16:10

Gaspa79


1 Answers

No, you cannot stack !important.. it doesn't work that way.

!important can be avoided a majority of the time, there are usually alternatives.

like image 121
Josh Crozier Avatar answered Sep 30 '22 23:09

Josh Crozier