Spacings (Padding)

Introduction

The padding properties are used to generate space around the content.

Padding is on the inside of block elements while margin is on the outside:

  • Use padding to move the contents away from the edges of the block.
  • Use margin to separate the block from things outside it.

Take a look at the following screenshot. Light blue area specifies 70px padding-top and light green specifies 70px margin-bottom.

Padding Properties

Property Values Description
Padding Top value Sets the left padding (space) of an element.
Padding Right value Sets the right padding (space) of an element.
Padding Bottom value Sets the top padding (space) of an element.
Padding Left value Sets the bottom padding (space) of an element.
Was this article helpful?
YesNo
Live Editor