It is a simple hack also known as the ‘* property hack’. It is useful when it comes to dealing with the older versions of Internet Explorer (i.e. IE6 and IE7). When we add * before any property name in CSS, it targets IE 7 and below version of IE browsers and reflects when loading the same CSS on the browser while it acts as junk for all other browsers including IE 8 and above.
Note: We can use underscore (_) for IE6 and the star (*) for IE7. Add _ or * in front of a CSS property when required.
color: blue; /* all browsers */ *color: blue; /* IE7 and below */ _color: blue; /* IE6 and below */
Below example illustrate the star-preceded property in CSS:
Example: In this example, we will see how an element preceding with a * behaves differently for different versions in IE. We can see that for element h1 we have added the property color beginning with a *.
Note: It is a kind of bug and it will only works for IE7 and below.
- Output For IE 7 and below: We can see that our h1 property with text GeeksforGeeks is green in color thus, *property name is excepted by this browser version.
- Output For IE 8 and above: We can see that our h1 property with text GeeksforGeeks is black in color showing that *property name is treated as junk in browser IE 8 and above.
- CSS | transition-property Property
- CSS | nav-up property
- CSS | all Property
- CSS | top Property
- CSS | nav-right property
- CSS | nav-down property
- CSS gap Property
- CSS | right Property
- CSS | tab-size Property
- CSS | column-gap Property
- CSS | padding-right Property
- CSS | bleed property
- CSS border Property
- CSS | nav-left property
- HTML | DOM name Property
- CSS | direction Property
- CSS | z-index Property
- Web API | DOMRect top property
- CSS | clear Property
- CSS | quotes Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.