Forum Moderators: not2easy

Message Too Old, No Replies

! important rule

css rule ! important

         

webaster

11:43 am on Jun 27, 2005 (gmt 0)

10+ Year Member



Will this work in all CSS compliant browsers - this rule is needed to hide certain images for ancient browsers.

the code [CSS]

<style type="text/css">
img.myimg { height: 12px!important; width: 21px!important; }
</style>

the code [HTML]

<img src="up.gif" class="myimg" height="0" width="0" alt="">

Edouard_H

3:48 pm on Jun 27, 2005 (gmt 0)

10+ Year Member



The !important rule can be used as a hack to serve different styles to compliant browsers than to IE. For example:

.someclass {width: 100px !important; width: 150px;}

Mozilla based browsers would assign a width of 100 pixels, IE 150.

In your case the !important rule will have no effect. Some "ancient" browsers like Netscape 4.x will ignore the image style anyway with or without it and use the width and height assigned in your HTML.