Mike's Blog

Margins Borders and Padding for Dummies

A quick guide to the Box Model

September 4th 2015

In this post we review the Box Model and the major players involved:


Padding

The CSS padding properties define the space between the element border and the element content. You can define the padding value the following way:


Border

The CSS border properties allow you to specify the style and color of an element's border.


Margin

The CSS margin properties define the space around elements. The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent.

You can define the element margin values the following way: