CSS Padding

CSS padding propertie is used to specify the space between the element content and border.

It is different from CSS margin it has important point which are given below.

CSS Padding

  • The Margin is the extra space around the control.
  • The Padding is extra space inside the control.
  • The Padding of an outer control is the Margin of an inner control.

CSS Padding Properties

Property Description
Padding You can set all the padding properties in one declaration.
Padding-left You can set left padding of an element.
Padding-right You can set right padding of an element.
Padding-top You can to set- top padding of an element.
Padding-bottom It is used to set the bottom padding of an element.

CSS Padding values

Value Description
Length It is used to fixed padding in pt, px, em etc.
% It is used to padding in % of containing the element.

The given following example will help you to understand the difference between the margin and padding.

Let us see an example of CSS padding:

Try Now

Leave a Comment