! important change with the weights
! important rule
The keyword ! important change the natural value of the style specification.
It does not matter whether between important and the exclamation mark is a space. The rule is supported by all browsers.
is the mode of action of the! Important rule, the "beat" the CSS priorities. With ! Important place the highest priority.
CSS code sample
# content ul li {
color: red;}
ul li {
color: blue important;
!}
In this example, the statement
# content ul li the highest priority. List items were presented to red. Without the ! important in the second statement would have the blue color indicating no effect on list items that are within the ID # content . By ! Important enter the second statement, however, a high value, list items are displayed so blue. valences of CSS style definitions
A rough breakdown of the values of the CSS looks like this:
- style ="..." (Specify in the HTML)
- # # eine_id
- div.eine_klasse eine_id div
- # eine_id
- div. Eine_klasse
- div div.eine_klasse
The actual weights are below the link below to filter SELFHTML .
Rating
Die! Important rule is part of the CSS standards and therefore perfectly legitimate to use. However, one must keep in mind the use of clear - it is CSS-design with the mallet. A CSS statement once with a ! provided important , you are from another location, with a well-written Cascade can no longer respond.
For large projects or for the quick solution, you are sometimes not without a ! Important from . Elegant solution is always to introduce a new class, or a clean Cascade write.
combination with other hacks
very relaxed - and that's the elegance of hacking - the important can combine it with other hacks!. A customer came recently with the request to me, only the CSS-design of a Page for the fix to IE6.
All relevant instructions for IE 6, I with the ! Have combined important . This was both made sure that ONLY was hit IE 6, but I had done the same in a few hours, the adjustments without me in the entire project to incorporate and understand the need to implement my predecessor. !
All relevant instructions for IE 6, I with the ! Have combined important . This was both made sure that ONLY was hit IE 6, but I had done the same in a few hours, the adjustments without me in the entire project to incorporate and understand the need to implement my predecessor. !
/ / combination of IE6 hack and important
* html # content {width
: 960px important;}
0 comments:
Post a Comment