Page 1 of 1

Ignoring CSS Hacks for IE 6 & 7

Posted: Thu May 27, 2010 9:17 pm
by kennedyrt
A common CSS hack for Internet Explorer 6 & 7 is to prefix the CSS property with either "*" or "_". It would be useful to add a flag to CSE HTML Validator v10 so that CSS properties with a prefix of either "*" or "_" are not marked as errors.

Re: Ignoring CSS Hacks for IE 6 & 7

Posted: Fri May 28, 2010 8:52 am
by Albert Wiersch
Thanks for the suggestion. Could you email some real-life examples of style sheets using these properties? They would be helpful. Please send them to support at htmlvalidator dot com. Thanks!

Re: Ignoring CSS Hacks for IE 6 & 7

Posted: Tue Jun 08, 2010 4:33 pm
by Albert Wiersch
Thanks. I received the files you sent.

I found this link with information about this "IE hack":
http://www.javascriptkit.com/dhtmltutor ... cks3.shtml

The next update of CSE HTML Validator will ignore the preceding "*" or "_" character (unless doing a "standards compliant" check) and generate a comment message like this:
CSS properties beginning with '*' or '_': 3 CSS properties were considered "IE hacks". Due to parsing methods, IE6 and below don't fail on properties beginning with "_", while IE7 and below don't fail on properties beginning with "*". Please note that this type of hack uses invalid CSS and should be avoided whenever possible.

Re: Ignoring CSS Hacks for IE 6 & 7

Posted: Sat Mar 19, 2011 1:20 am
by ormaaj
Some "real world" examples from the widely-used YUI CSS resets:

http://yui.yahooapis.com/3.3.0/build/cssreset/reset.css

Code: Select all

/*to enable resizing for IE*/
input,
textarea,
select {
	*font-size:100%;
}
http://yui.yahooapis.com/3.3.0/build/cssbase/base.css

Code: Select all

/* setting a consistent width, 160px; 
   control of type=file still not possible */
input[type=text],input[type=password],textarea{width:12.25em;*width:11.9em;}
http://yui.yahooapis.com/3.3.0/build/cssfonts/fonts.css

Code: Select all

/**
 * Percents could work for IE, but for backCompat purposes, we are using keywords.
 * x-small is for IE6/7 quirks mode.
 */
body {
	font:13px/1.231 arial,helvetica,clean,sans-serif;
	*font-size:small; /* for IE */
	*font:x-small; /* for IE in quirks mode */
}

Code: Select all

/**
 * Bump up IE to get to 13px equivalent for these fixed-width elements
 */
pre,
code,
kbd,
samp,
tt {
	font-family:monospace;
	*font-size:108%;
	line-height:100%;
}
All of these use the star hack