CSS padding
The CSS padding properties define the space between the element border and the element content.
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.
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.
p { padding:2cm 4cm 3cm 4cm; }
Definition and Usage
The padding shorthand property sets all the padding properties in one declaration. This property can have from one to four values.
Examples:
- padding:10px 5px 15px 20px;
- top padding is 10px
- right padding is 5px
- bottom padding is 15px
- left padding is 20px
- padding:10px 5px 15px;
- top padding is 10px
- right and left padding are 5px
- bottom padding is 15px
- padding:10px 5px;
- top and bottom padding are 10px
- right and left padding are 5px
- padding:10px;
- all four paddings are 10px
Note: Negative values are not allowed.
=======================================
CSS Margin
The CSS margin properties define the space around elements.
Margin
The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent.The top, right, bottom, and left margin can be changed independently using separate properties. A shorthand margin property can also be used, to change all margins at once.
Không có nhận xét nào:
Đăng nhận xét