We're using a Html Wrapper supplied by a client, which references a reset style sheet that sets the <p>
element's margin to 0px. I'd like to have a normal top & bottom margin with my <p>
elements, so can somebody tell me what it should be?
views:
60answers:
4
+5
A:
They're browser dependent. That's why most people use a reset sheet - to normalize them before they attempt to customize them.
g.d.d.c
2010-07-16 15:57:23
Is there a margin that *most* browsers use?
DaveDev
2010-07-16 15:58:27
No, there is no set requirement or 'standard'. My advice would be to keep the reset sheet, and then set your top and bottom to what you want to see.
g.d.d.c
2010-07-16 15:59:25
“No, there is no set requirement or 'standard'” — that’s not exactly what was asked though. I think most browsers use 1em. Like most use 16px as a default font size, and 1.2 as a default line height.
Paul D. Waite
2010-07-16 16:06:31
http://css-class.com/test/css/defaults/UA-style-sheet-defaults.htm has a (non-exhaustive) list of default styles applied by a variety of browsers. But yes, personally I'd simply reset these to my own values, not try to second-guess the browser.
Matt Gibson
2010-07-16 16:10:15
+2
A:
Browser specific CSS defaults are outlined here.
Here's an extract of relevance for the margin of the p
element:
- W3:
1.12em 0
- IE7:
14.25pt 0
- IE8:
1em 0
- FF2:
1em 0
- FF3:
1em 0
- Opera:
1em 0
- Safari 3.1:
1em 0
Reset stylesheets are by the way ridiculous. Just set the desired margin yourself if you want it to be consistent among browsers.
p {
margin: .75em 0;
}
See also:
BalusC
2010-07-16 18:37:09
+1 for the detail, but disagree with you on reset stylesheets. I find they save me time as I don't need to troubleshoot nearly as many browser inconsistencies. However, this benefit disappears if the site has need to optimize for high volume traffic.
kingjeffrey
2010-07-16 22:11:08