Ignoring CSS Hacks for IE 6 & 7

For topics about current BETA or future releases, including feature requests.
Post Reply
kennedyrt
Rank II - Novice
Rank II - Novice
Posts: 20
Joined: Fri Nov 09, 2007 9:57 pm
Location: Kent, Washington

Ignoring CSS Hacks for IE 6 & 7

Post by kennedyrt » Thu May 27, 2010 9:17 pm

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.

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3453
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Ignoring CSS Hacks for IE 6 & 7

Post by Albert Wiersch » Fri May 28, 2010 8:52 am

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!
Image
Albert Wiersch

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3453
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Ignoring CSS Hacks for IE 6 & 7

Post by Albert Wiersch » Tue Jun 08, 2010 4:33 pm

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.
Image
Albert Wiersch

ormaaj
Rank I - Novice
Rank I - Novice
Posts: 10
Joined: Mon Nov 15, 2010 8:25 am

Re: Ignoring CSS Hacks for IE 6 & 7

Post by ormaaj » Sat Mar 19, 2011 1:20 am

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

Post Reply