Ignoring CSS Hacks for IE 6 & 7

For topics about current or future BETA releases, including feature requests.

Ignoring CSS Hacks for IE 6 & 7

Postby 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.
kennedyrt
Rank I - Novice
Rank I - Novice
 
Posts: 15
Joined: Fri Nov 09, 2007 10:57 pm
Location: Renton, Washington

Re: Ignoring CSS Hacks for IE 6 & 7

Postby 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: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: Ignoring CSS Hacks for IE 6 & 7

Postby 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
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: Ignoring CSS Hacks for IE 6 & 7

Postby 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
ormaaj
Rank I - Novice
Rank I - Novice
 
Posts: 10
Joined: Mon Nov 15, 2010 9:25 am


Return to CSE BETA Talk

Who is online

Users browsing this forum: No registered users and 1 guest

cron