Home > Article > Web Front-end > CSS Syntax Manual (4) Text Fill, Border, Boundary and Position Properties (2)
3. Box border attributes
1. margin-bottom
margin-left
margin-right
margin-top
Function: These four attributes are used to set the distance between an element and its adjacent elements. You can use length or relative Defined as a percentage of the width of its parent text, this can also be handled automatically.
Value:
Length - Set the relative or absolute distance between the corresponding side of the element and the edge of the box. Valid units are: mm, cm, in, px, pt, pica,ex, em...
Percent - based on the width of the parent element Sets the border size as a percentage.
auto - Automatic, this setting takes the browser's default borders.
Example
2. margin
Function: shorthand attribute, used to set all boundaries of elements. This is used to describe the distance from the edge of the element's content to the edge of the box. This area is always transparent, so the page background underneath can be seen.
Value:
Length - Same as before
Percent - Sets the border size as a percentage of the parent element's width.
auto - Automatic, this setting takes the browser's default borders.
Example
4. Box position attribute
1. Height
Function: Set the height of the element, and the browser adjusts the graphics according to this height.
Values:
Length - mm, cm, px, pt, .....
auto - automatic.
2. width
Function: Set the width of the element, and the browser adjusts the graphics according to this width.
Values:
Length - mm, cm, in, px, pt, ...
Percentage - Sets the graphic dimensions as a percentage of the parent element's width.
auto - automatic adjustment
3, float
function: used to place elements outside the normal element flow layout rules.
Value:
none - no change.
left - Place other element content to the right of the floated element.
right - Place other element content to the left of the floated element.
4. clear
Function: Used to allow or prohibit the placement of other elements (usually online graphics) next to the specified element.
Value:
none - no limit.
left - Place the element below the left floating element
right - Place the element below the right floating element
both - No floating elements are allowed on both sides of the element
The above is the CSS syntax manual (4) text padding, border, border and The content of location attribute (2), for more related content, please pay attention to the PHP Chinese website (www.php.cn)!