youngros Posted December 27, 2008 Report Share Posted December 27, 2008 I am looking at rebuilding one of my sites again, as it has been commented that people can't find things on the site, so I am looking to make the navigation simpler. On having a look around at various css templates for ideas on what my work, I found one that could be adapted for my needs. The question is how does the following work * { padding: 0; margin: 0; } at the top of the style sheet. I can see what it does on the resulting page, but I don't understand how. Quote Link to comment Share on other sites More sharing options...
Andrea Posted December 27, 2008 Report Share Posted December 27, 2008 (edited) I use *{padding: 0; margin: 0;} on all my CSS - various browsers have various default settings for various properties, and setting them all to 0 first and then adding the exact measurement you want later, prevents many cross-browser inconsistencies. However, the opinions are divided - I find the above is simple and fast and takes care of everything at once, others belief it to be more efficient to only set to zero those properties that could be affected like so: body, address, blockquote, dl, ol, ul, li, fieldset, form, h1, h2, h3, h4, h5, h6, p, pre { margin:0; padding:0; } Edited December 27, 2008 by Andrea Quote Link to comment Share on other sites More sharing options...
monkeysaurus Posted December 27, 2008 Report Share Posted December 27, 2008 The star is just a short hand way of way of selecting every element on the page and applying a margin and padding of zero to them. The star is just a selector, like any other: *{ margin:0; padding:0 } div#content{ margin:0; /*This div already has a margin of zero due to the rule above*/ } This is quite a slow process, and there are better ways of reseting CSS - check out the Yahoo reset CSS, for example. Quote Link to comment Share on other sites More sharing options...
youngros Posted December 27, 2008 Author Report Share Posted December 27, 2008 Thought it was something like that, thanks everyone. Quote Link to comment Share on other sites More sharing options...
amitte Posted December 28, 2008 Report Share Posted December 28, 2008 ok i didnt get somthing.. way should i reset my css? i built a couple of web pages... and i did'nt put any thing to "reset" the css file.... so my Q's R- 1. what is "reseting CSS"? 2. why should i use it? Quote Link to comment Share on other sites More sharing options...
JBall Posted December 28, 2008 Report Share Posted December 28, 2008 By default certain elements carry a predetermined padding and margin. If you are seeing extra spaces between elements on your page, this could be the culprit. By "resetting" these elements to zero, you have control over placement. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted December 28, 2008 Report Share Posted December 28, 2008 Just to add to JBall's post, "resetting" the CSS is especially useful to eliminate differences between browsers. Some browsers have different defaults, so if you reset them, it gives you more precise control, and may eliminate inconsistencies. Quote Link to comment Share on other sites More sharing options...
amitte Posted December 28, 2008 Report Share Posted December 28, 2008 ok thnks... i think i got the main idea about that.... and i now know that i defently need to use it. so where exectly i put the star "*" with the "reset" peremiters? Quote Link to comment Share on other sites More sharing options...
falkencreative Posted December 28, 2008 Report Share Posted December 28, 2008 ok thnks... i think i got the main idea about that.... and i now know that i defently need to use it. so where exactly i put the star "*" with the "reset" perimeters? Usually you would put that at the start of your CSS file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.