Is there a need for zero-out DIV's margin and padding?
Posted
by ssg
on Stack Overflow
See other posts from Stack Overflow
or by ssg
Published on 2010-05-05T13:41:04Z
Indexed on
2010/05/05
13:48 UTC
Read the original article
Hit count: 168
I wonder if on any browser div
element comes with a preset margin/padding value other than zero. As far as I know, div
and span
come with zero padding and margin values by standard to make them suitable canvas for style decoration.
Even better, is there a definite standard for default styles for all elements that is cross-browser which we can make assumptions upon? For instance FORM comes with top/bottom margin
s, OL/UL come with padding-left
's.
I occasionally see a
* {
margin: 0;
padding: 0;
}
and this just looks like a dirty hack without knowing the reasons or consequences. Anyone has any better approach to this?
© Stack Overflow or respective owner