Difference between Margin, Border, and Padding

In CSS, each element is represented as a rectangular box according to the standard CSS box model. The box allows us to define the size, position, and properties of these element's. Each box is composed of 4 parts: the content area, padding area, border area and margin area.

CSS Box model

To help explain these spacing concepts the indvidual elements can be visualised as picture frames on a wall.