3

Possible Duplicate:
What does an * (star) mean in front of a CSS declaration?

I found this css on an aquincum template :

.fluid .grid4 { width: 31.914893614%; *width: 31.8617021246383%; }

So what is the meaning of puting the * symbol ? When should it be present ?

Community
  • 1
  • 1
pheromix
  • 18,213
  • 29
  • 88
  • 158

3 Answers3

8

It applies the property value to IE7 and below. It's also invalid CSS. See http://www.webdevout.net/css-hacks#unrecommended-asterisk_prefix.

You should consider conditional comments instead.

devdigital
  • 34,151
  • 9
  • 98
  • 120
2

* is ignored by IE6 while other browser don't ignore it, and such don't apply that styling. Similarly, you can use use _ for IE7. It is something of a hack.

Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
  • "* is ignored by IE6 ??" Doesn't seem in line with the most voted answer above - "applies the property value to IE7 and below" Why it has a upvote ?? – Anmol Saraf Nov 23 '12 at 08:31
2

That is a CSS hack, that is supposed to make the style apply only in IE7 and below.

As with most CSS hacks, this is using incorrect code to make browsers react in a specific way. If you use it, you have to text your code with every new browser version released to be sure that it reacts the way that you expect.

You can find a litte more information about it here: http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • So I should remove the code `*width: 31.8617021246383%;` ? – pheromix Nov 23 '12 at 08:27
  • You can remove it, as it's invalid CSS. But if you plan on keeping it, you'll have to 'hack' every style if needed so all browsers react te same. IE will always act different than most browsers – BlueCacti Nov 23 '12 at 08:29