tags:

views:

41

answers:

1

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 margins, 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?

+5  A: 

Different browsers have different defaults -- this is why using CSS resets like these

are popular in order to insure that browsers are treating all the elements equally. It gives you a baseline and then expects you to define all the relevant styling.

Erik
YUI reset looks like the right way of doing it, thanks.
ssg