CSS

CSS Intro

CSS Intro Quiz

CSS Intro Exercise

CSS Basic

CSS Basic Quiz

CSS Basic Exercise

CSS Advance

CSS Advance Quiz

CSS Advance Exercise

CSS3

CSS3 Quiz

CSS3 Exercise

CSS Properties

CSS Functions

CSS Selectors

CSS padding Property

CSS padding Property

 

 

The padding property is used to specify the padding for an element. It is a shorthand property for:-

  • padding-top
  • padding-right
  • padding-bottom
  • padding-left

 

For Your Information:-

 

  1. If the padding property has four values then the margin is applied from the top, right, bottom, and left.
  2. If the padding property has three values then the margin is applied to the top, right and left, and bottom.
  3. If the padding property has two values then the margin is applied to the top and bottom, and right and left.
  4. If the padding property has one value then it is applied to all four sides.

We can use negative values in it.

 

Default Value:-

 

Its default value is 0.

 

Syntax:-

 

Its syntax is:- padding: length | initial | inherit;

 

Further Explanation:-

 

Value Description
length Specifies a padding in px, pt, cm, etc.
% Specifies padding in percent of the width of the containing element
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Code Explanation

All Tutorials related to CSS Properties

All Sections related to CSS