If you have worked in CSS (Cascading Style Sheets), you might have noticed that the nested styles take precedence over the global ones. For Example, consider the following,

.box{
 	width:100px;
 	height:100px;
 	background:silver;
 	border:1px solid black;
}

And I use the above style in my page as follows,

<div class="box"></div>
<div class="box" style="width:200px"></div>

Here, the width of the second will be 200px since the inline style overrides the globally declared style. But the CSS trick to still enforce the global style is to make the concerned style attribute IMPORTANT. In the above example if I have to keep my second div restricted to 100px then I will declare it as IMPORTANT as follows,

.box{
 	width:100px !important;   /*width restricted to 100px. This is final*/
 	height:100px;
 	background:silver;
 	border:1px solid black;
 }

Its simple to co relate the !important property as a final variable in java. Sometimes you do not your styles to be overridden by other designers either through javascript or inline style. The !important property is the thing which would help in this case.


Stumble Digg Technorati Subscribe Delicious