Each browser has it’s own default rules and when it comes to padding and margin’s it can cause havoc when creating the CSS for a website.
However, there is a simpler solution than trying to change the code for each indivdual element that’s causing problems.
Using the following code at the start of a CSS document will set all padding and margin’s to zero and give you a consistent starting point.
* {
padding: 0;
margin: 0;
}
Dave Woods » Creating a Simple CSS Layout
4 years ago
[...] as I mentioned in the Quick Tip: Reset Padding and Margin post a few weeks ago, I use the universal selector to reset all the padding and margins of the [...]
John Porter
4 years ago
I thought that the * only worked in IE and was why it gets used in hacks?
Am I wrong?
Dave
4 years ago
I believe * html #style only works in IE but the * selector is supported in all browsers.
I’d recommend using conditional comments where required though to get around the bugs in IE6 and lower instead of using hacks.
IE7 despite not being completely standards compliant, shouldn’t need any hacks.
shaka
4 years ago
i just bought css and i uploaded it to my pc and it is competly up but when i click to play it ,i just get a black screen and then this comes up
the instructio at “ox10743e2c” referenced memory at “0x0e54a1ao”. the memory could not br “read”
can you help me please????
Dave
4 years ago
Hi Shaka, I’m sorry but I think you’re talking about a completely different CSS to the “Cascading Style Sheets” which is discussed here?