Solved

what "*"  means in css class

Posted on 2011-09-28
4
200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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 Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

920 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

16 Experts available now in Live!

Get 1:1 Help Now