CSS - Padding properties

Paddings are part of the box formatting model. Each element formatted in this model is in one or more rectangular boxes representing the padding, border and margin areas.

The padding Properties determine how much space is to be inserted between the border and the actual content of the element.

Padding

Property

Description

Values

Sample Code

padding

Sets all of the padding properties of an element from one to four values

length
percentage

p {padding: 2em 2em}

padding-bottom

Sets the bottom padding properties of an element

length
percentage

p {padding-bottom: 5px}

padding-left

Sets the left padding properties of an element

length
percentage

p {padding-left: 12px}

padding-right

Sets the right padding properties of an element

length
percentage

P {padding-right: 10%}

padding-top

Sets the top padding properties of an element

length
percentage

P {padding-top: 2px}

Samples

Result:

CSS Padding {padding: 5px 10px 5px 10px; } (TOP LEFT BOTTOM RIGHT)




This website is hosted for free by Freewebs.com - free website. Get your own Free Website now!