Ignoring CSS Hacks for IE 6 & 7
Ignoring CSS Hacks for IE 6 & 7
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.
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Ignoring CSS Hacks for IE 6 & 7
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!
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Ignoring CSS Hacks for IE 6 & 7
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.
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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Re: Ignoring CSS Hacks for IE 6 & 7
Some "real world" examples from the widely-used YUI CSS resets:
http://yui.yahooapis.com/3.3.0/build/cssreset/reset.css
http://yui.yahooapis.com/3.3.0/build/cssbase/base.css
http://yui.yahooapis.com/3.3.0/build/cssfonts/fonts.css
All of these use the star hack
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%;
}
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;}
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%;
}