The star-property hack

Posted by sh1mmer on Jul 5, 2006 in General |

So, in my new position as a Web Developer at Yahoo! I’ve been working on the homepage for the UK and others. I’ve been documenting the CSS we are using. There are one or two odd hacks we use, but strangely I couldn’t find one of them using *cough* Google.

The “Underscore hack” has already been documented. However we are using something really similar. I am calling this the Star-Property hack which is distinct from the Underscore hack, and more particularly the Holly Hack, which comes up a lot when searching for ‘star property css hack’. The Star-Property hack takes the form below, which I am also using as a test page:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd";>
<html>
<head>
<style type="text/css">
body {
*background:red;
}
</style>
</head>
<body>
</body>
</html>

As you can see you use a normal selector but insert a * before the property name. This is legal in CSS 2.1 as Pixy notes in the Underscore hack. However, the properties no should not exist. The IE family ignore the *, however, and apply the property without it. I have tested all verison of IE from 5.0-7b2 and they will all apply this rule, unlike the Underscore hack which is not applied in 7b2. No other browser I tested (Firefox 1.0 & 1.5, Netscape 8, Opera 8.5 or Safari 2) applied this rule.

N.b. obviously these opinions are my own and not Yahoo!’s

Share with friends:
  • Twitter
  • HackerNews
  • del.icio.us
  • Reddit
  • Digg
  • StumbleUpon

blog comments powered by Disqus

Copyright © 2012 Kid666 Blog All rights reserved. Base theme by Laptop Geek.