CSS Padding =========== The CSS padding properties define the space between the element border and the element content. The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element. The top, right, bottom, and left padding can be changed independently using separate properties. A shorthand padding property can also be used, to change all paddings at once. Value Description --------------------------------------------------------- length Defines a fixed padding (in pixels, pt, em, etc.) % Defines a padding in % of the containing element All CSS Padding Properties -------------------------- Property Description ---------------------------------------------------------------------------------------------- padding A shorthand property for setting all the padding properties in one declaration padding-bottom Sets the bottom padding of an element padding-left Sets the left padding of an element padding-right Sets the right padding of an element padding-top Sets the top padding of an element Padding - Individual sides -------------------------- padding-top:25px; padding-bottom:25px; padding-right:50px; padding-left:50px; Padding - Shorthand property ---------------------------- The padding property can have from one to four values. padding:25px 50px 75px 100px; top padding is 25px right padding is 50px bottom padding is 75px left padding is 100px padding:25px 50px 75px; top padding is 25px right and left paddings are 50px bottom padding is 75px padding:25px 50px; top and bottom paddings are 25px right and left paddings are 50px padding:25px; all four paddings are 25px Example 1 ---------

This text has equal padding on each side. The padding on each side is 2cm.

This text has a top and bottom padding of 0.5cm and a left and right padding of 3cm.

Example 2 ---------

This is a text with no left padding.

This text has a left padding of 2 cm.

This text has a left padding of 50%.

Example 3 ---------

This is a text with no right padding. This is a text with no right padding. This is a text with no right padding.

This text has a right padding of 2 cm. This text has a right padding of 2 cm. This text has a right padding of 2 cm.

This text has a right padding of 50%. This text has a right padding of 50%. This text has a right padding of 50%.

Example 4 ---------

This is a text with no top padding. This is a text with no top padding. This is a text with no top padding.

This text has a top padding of 2 cm. This text has a top padding of 2 cm. This text has a top padding of 2 cm.

This text has a top padding of 50%. This text has a top padding of 50%. This text has a top padding of 50%.

Example 5 ---------

This is a text with no bottom padding. This is a text with no bottom padding. This is a text with no bottom padding.

This text has a bottom padding of 2 cm. This text has a bottom padding of 2 cm. This text has a bottom padding of 2 cm.

This text has a bottom padding of 50%. This text has a bottom padding of 50%. This text has a bottom padding of 50%.