Latest web development tutorials

CSS Padding (padding)

Space definition element border and the element content between CSS Padding (padding) property.


Padding (padding)

When Padding elements (filled) (padding) is cleared, the "release" of the element area fills the background color would be.

Alone fill properties can change up and down around the filling. Acronym filling properties can also be used to change once everything changed.

Possible values

value Explanation
length Defines a fixed padding (pixels, pt, em, etc.)
% Use a percentage value to define a filling


Padding - padding property unilateral

In CSS, it can specify a different side of the different filling:

Examples

padding-top:25px;
padding-bottom:25px;
padding-right:50px;
padding-left:50px;

try it"


Filling - shorthand property

To shorten the code, which you can specify all the padding properties in one property.

This is called a shorthand property. Shorthand property for all the fill attribute is "padding":

Examples

padding: 25px 50px;

try it"

Padding property can have one to four values.

padding: 25px 50px 75px 100px;

  • The filling is 25px
  • Right padding to 50px
  • Under filled 75px
  • Left filled 100px

padding: 25px 50px 75px;

  • The filling is 25px
  • Filled with about 50px
  • Under filled 75px

padding: 25px 50px;

  • Bottom padding is 25px
  • Filled with about 50px

padding: 25px;

  • All are filled 25px

Examples

More examples

All padding properties in one declaration
This example demonstrates the use of abbreviations property is set in a declaration of all fill attributes, can have one to four values.

Set left portion filled
This example demonstrates how to set the left padding element.

Setting the right part of filling
This example demonstrates how to set the right padding element. .

Setting an upper filling
This example demonstrates how to set the filling element.

Lower packed
This example demonstrates how to set the padding under the elements.


All CSS padding properties

Attributes Explanation
padding Abbreviations property is set in a declaration of all fill attributes
padding-bottom Setting underfill element
padding-left Left portion of the fill settings element
padding-right Setting the right portion of the filling element
padding-top Settings at the top elements to fill