0

This is the first time i'm going to encounter this I've scrape a website and extracted all the styles and one thing that caught my eye is this code like so:

   ul.tabs { 
      position: absolute; 
      margin-top: 480px; 
      width:100%; 
      background: URL("../design/images/masters/bkng-tabs-navigation.png") no-repeat 50% 17px; 
      height: 70px;  
      *margin-left: -487px; /* What is "*" in here */
   }

What is the meaning of '*' in *margin-left because when I removed it, it doesn't work

user3093453
  • 699
  • 2
  • 7
  • 24
  • http://stackoverflow.com/questions/1667531/what-does-a-star-preceded-property-mean-in-css – r3wt Aug 12 '14 at 03:55
  • Oh pardon for that I just didn't use `asterisk` keyword when I tried to search. You can close this thread tho. Thanks! – user3093453 Aug 12 '14 at 03:57

1 Answers1

2

It's called the star hack. It's a way of resetting a CSS attribute for only IE7 or below, because these browsers have a bug that let them ignore the star and apply the attribute named after the star. Other browsers will see *[attribute name] and consider it malformed or unknown, and ignore it.

In your case, it will only apply margin-left: -487px; on IE7 or below; other browsers/versions of IE will ignore that.

This is generally considered poor form or a code smell.

moribvndvs
  • 42,191
  • 11
  • 135
  • 149