:jawdrop:
hi,
could you tell me what is this asterisk all about, pls. take a look at this below,
* {
margin: 0;
padding: 0;
}
what this character --> * can do? what is this for?
thanks in advance.
It's a wild card. It means
It's a wild card. It means "everything".
what it can do? could you
what it can do?
could you give me a basic scenario for this wildcard?
anna_single16 wrote:what it
what it can do?
could you give me a basic scenario for this wildcard?
Just like in your example above.
* {
margin: 0;
padding: 0;
}
That causes everything to have no margin and no padding. Everything on the page. Absolutely everything.
Does this wildcard affect
Does this wildcard affect all
how about let say i'll override it like this below,
* {
margin: 0;
padding: 0;
}
// override.
h1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
color: #986161;
padding: 8px 8px 4px;
}
ok, what will happen now, does this will override the asterisk character?
or it has no effect at all?
thanks in advance.
Yes it does. Stylesheets are
Yes it does. Stylesheets are read from top to bottom. Anything that comes later in the sheet overrides things that come earlier.
You just use the * (universal selector) to zero everything first, and then style from there.
thanks guys
thanks guys :rolleyes:
Anna you probably ought to
Anna you probably ought to read through this page from the W3C explaining the various selectors so you have better understanding of how they work and what are available (bearing in mind that not all selectors are supported by all browsers, which it doesn't cover)
http://www.w3.org/TR/REC-CSS2/selector.html
And I would also have a read through the specs on cascade and inheritence of CSS rules, which a slightly harder page to to understand but covers important fundemental aspects of how things are handled
http://www.w3.org/TR/REC-CSS2/cascade.html
Hugo.
You also don't want to use
You also don't want to use that, it's called a "global reset".
Have a look here:
http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
zero default rules are a
zero default rules are a debatable issue but cos Meyers pronounced on the subject everyone is slavishly following, without I doubt having any real understanding of what the extended rulesets are designed to cope with :shrug:
Well yes, I still
Well yes, I still occasionally use a * reset, but I just thought I'd throw it in there
Hugo wrote:but cos Meyers
but cos Meyers pronounced on the subject
With some well backed-up evidence. The global reset screws with forms elements.
Phreestyle wrote:Yes it
Yes it does. Stylesheets are read from top to bottom. Anything that comes later in the sheet overrides things that come earlier.
You just use the * (universal selector) to zero everything first, and then style from there.
You're right, but you're also wrong.
Style rules are applied according to their specificity. More specific rules applying before less specific rules. If two or more rules affecting the same element have the same specificity, the last one wins.
The universal selector has less specificity than any other selector, ie. it doesn't matter where the * selector rules are placed with respect to other rules, the other rules will always override the * selector rules.
However, a sensible style sheet organisation strategy is to place the more general rules first. That is, *, then element tag rules, then common classes then ids and descendent styles.
Tyssen wrote:Hugo wrote:but
Hugo wrote:but cos Meyers pronounced on the subject
With some well backed-up evidence. The global reset screws with forms elements.
I wasn't knocking Meyer (dodgy out of context quoting ) and yes was aware of the problem with the universal reset. Trouble is not so much with resets per se but more with possibly people not being aware of the critical nature of controlling default settings whatever approach is taken.