Forum Moderators: not2easy

Message Too Old, No Replies

Valid replacement for the underscore hack?

IE specific?

         

efes

9:47 am on May 10, 2004 (gmt 0)

10+ Year Member



Hi everybody,

I need some help here. I’m in a situation were I need to make some code specific for IE. This can be done, by adding an underscore as the first character but this isn’t valid according to W3C’s Validator. Since I’d like to write valid code I need another way to make the code IE specific. Preferably one solution for all versions, if possible. I would prefer just one stylesheet.

Example:
#iframeWrapper {
_float:left;
padding-right:125px;
_padding-right:0px;
padding-left:125px;
_padding-left:0px;
}

SuzyUK

10:31 am on May 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HI efes..

the "star HTML" hack should do nicely. It applies to all versions of IE but can be hidden from IE/Mac if required.

#yourdiv {rules} = all browsers

* html #yourdiv {rules} = IE (allversions) only

IE "thinks" it has another root element above <html> apparently and by accessing it using the * (asterisk) html specificity only IE will read the above rule as being valid

it can then be hidden from Mac using the commented backslash hack if required (which when using floats might be required ;))

/* hide from IE/Mac \*/
* #yourdiv {rules}
/* end hide */

now only IE/Win will read the rule..

and it validates

Suzy

efes

12:36 pm on May 10, 2004 (gmt 0)

10+ Year Member



Hi SuzyUK,

Thank you, very much. That was just what I needed.