1

While reading the CSS code of Twitter bootstrap, I noticed that some elements have a CSS rules with a * at the beginning. For example:

.row-fluid {
    width: 100%;
   *zoom: 1;
}

Why is this technique being used?

Rorchackh
  • 2,113
  • 5
  • 22
  • 38

3 Answers3

6

Ignore posts about * being an "everything" selector, as it is, but that isn't what it is in this case.

Putting * before an attribute allows you to target ie7 and below. This is an old hack that shouldn't really be used as you can target ie7 and below in better ways.

Quick explanation of how to target older IE versions. If you read to the bottom you will see he explains that it is better to use conditional comments than hacks, as they are after all, hacks.

Andy
  • 14,427
  • 3
  • 52
  • 76
  • 3
    Never mind that this question is a duplicate many times over - why the hell do people keep answering `*` is the universal selector to questions that obviously are asking about an entirely different (albeit invalid) use of `*`? – BoltClock Nov 26 '12 at 10:39
  • 2
    @BoltClock They don't read the question properly because they are rushing to get the first answer in :P – Andy Nov 26 '12 at 10:40
  • For some technical details, [here's the Wikipedia article about CSS filters, and, in particular, the "star hack"](http://en.wikipedia.org/wiki/CSS_filter#Star_hack) – Josh Jan 09 '15 at 14:32
2

The asterisk is a hack for IE6 and IE7.

see: http://paulirish.com/2009/browser-specific-css-hacks/

banana
  • 1,186
  • 4
  • 14
  • 26
1

In this case, I think is a hack for ie6/7

obl
  • 76
  • 1