Browser Defaults

Default CSS values for spacing (margin and padding) and font size for the following HTML tags:

  • body
  • display: block;
    margin: 8px;

  • p
  • display: block;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;

  • h1
  • display: block;
    font-size: 2em;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;

  • ul
  • display: block;
    list-style-type: disc;
    margin-top: 1em;
    margin-bottom: 1 em;
    margin-left: 0;
    margin-right: 0;
    padding-left: 40px;

  • li
  • display: list-item
  • text-align: match-parent  
  • text-align: match-parent
  • text-align: match-parent

When an element has margin and/or padding, is it the same on all 4 sides (top, right, bottom, left) or different? When an element has margin and/or padding it could be the same on all four sides but it could also be different for each side, it depends.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top