Jan
6
6
CSS Padding
Posted in CSS Tutorials by kdwhd
0
CSS Padding
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.
Possible Values
| px | Defines a fixed padding in pixels |
| % | Defines padding in percentages |
The top, right, bottom, and left padding can be changed independently using separate properties.
1 |
#container { padding-top: 100px; padding-right: 50px; padding-bottom: 25px; padding-left: 75px; }
|
A shorthand padding property can also be used. The order of the values are: top, right, bottom left.
1 |
#container { padding: 100px 50px 25px 75px; }
|
If all four sides are to be the same:
1 |
#container { padding: 75px; }
|









