Solved

what "*"  means in css class

Posted on 2011-09-28
4
199 Views
Last Modified: 2012-08-13
I have copied an css file from an existing web page.

In the style sheet i have found this code

* {
    margin: 0;
    padding: 0;
}


I have no idea what this is for, could any one explain this to me.
0
Comment
Question by:ziorinfo
  • 2
4 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 36716542
This is the "star property hack" along the same lines as the "underscore hack." It includes junk before the property that IE ignores (the * works up to IE 7, the _ up to IE 6).


refer
http://stackoverflow.com/questions/1667531/what-does-a-star-preceded-property-mean-in-css

http://www.ejeliot.com/blog/63
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36716639
If you want to apply only to IE then use * preceded. In short it is just IE specific rule.
0
 
LVL 2

Accepted Solution

by:
WizardOfOgz earned 50 total points
ID: 36717633
This is NOT an example of star hack or an IE-specific rule.

* is the universal CSS selector which matches an element of any type.  See http://www.w3.org/TR/CSS2/selector.html#universal-selector

The rule you posted will be apply a 0 margin and padding to all elements.
0
 
LVL 2

Expert Comment

by:WizardOfOgz
ID: 36717645
If you are curious about the star hack that was mentioned and similar CSS hacks for IE you can read about them here
http://en.wikipedia.org/wiki/CSS_filter#Star_hack
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now