Default values for box model properties


#1

Question

what are the default values of padding, border, and margin?

Answer

Depending on each browser those values will vary, therefore is commonly recommended to “reset” those values to 0 in a CSS file. Browsers provide default values for a general support for legible content, but sometimes they will get on your way. Another thing is that not all tags get the same default values for padding or margin, although the only default value for border is medium none currentcolor where medium is the thickness, none is the style, and currentcolor sets it to the color of the background.
Here is a list of common tags and their most common default values:

body  - margin: 8px;

h1 - margin-top: 0.67em;
     margin-bottom: 0.67em;

h2 - margin-top: 0.83em;
     margin-bottom: 0.83em;

h3 - margin-top: 1em;
     margin-bottom: 1em;

h4 - margin-top: 1.33em;
     margin-bottom: 1.33em;

h5 - margin-top: 1.67em;
     margin-bottom: 1.67em;

h6 - margin-top: 2.33em;
     margin-bottom: 2.33em;

p - margin-top: 1em;
    margin-bottom: 1em;

ol - margin-top: 1em;
     margin-bottom: 1em;
     padding-left: 40px;

ul - margin-top: 1em;
     margin-bottom: 1em;
     padding-left: 40px;

Note: Those are mainly text based elements.


#2

#3