In CSS, they are all box-type attributes used to indicate the distance.
Margin: blank outside the border of the layer, padding: blank between the border of the layer and the content of the layer, border: border, content: content.
The border attribute (border) is used to set the edge of an element.
The margin attribute (margin) is used to set the distance between the edge of an element's space and adjacent elements.
The gap attribute (padding) is used to set the distance from the element content to the element boundary.
These three attributes belong to the box type attribute in CSS.
1. border style border
Syntax: border-width | border-style | border-color
Parameter: This attribute is a composite attribute. See the attributes of each parameter.
The default value is medium none. The default value of border-color is text color. To use this attribute, you must first set the height or width attribute of the object, or set the position attribute to absolute.
Example: p {border: thick double yellow ;}
2. Blank Padding. Syntax: padding: length
Parameter: length value or percentage composed of floating-point numbers and unit identifiers. The percentage is based on the width of the parent object. See length units.
Padding Abbreviations:
Search for or set the patch margins on the four sides of an object. If all four parameter values are provided, the top-right-bottom-left parameters are added to the four sides. If only one edge is provided, all four edges are used. If two are provided, the first is used for top-bottom, and the second is used for left-right. If three are provided, the first is used for the top, the second is used for the left-right, and the third is used for the bottom.
Example: p {padding: 36pt 24pt 36pt ;}
3. Margin margin, Syntax: Margin: auto | length
Parameters:
Auto: the value of the relative edge.
Length: The length value or percentage composed of floating point numbers and unit identifiers. The percentage is based on the height of the parent object.
Margin Abbreviations:
If all four parameter values are provided, the top-right-bottom-left parameters are added to the four sides. If only one is provided, all the four sides are used. If two are provided, the first is used for top-bottom, and the second is used for left-right. If three are provided, the first is used for the top, the second is used for the left-right, and the third is used for the bottom.
The Margin attributes of margin include: margin-top --- top margin, margin-right --- right Margin, margin-bottom --- bottom margin, and margin-left --- left margin.
Example:
Body {margin: 36pt 24pt 36pt ;}
Body {margin: 11.5% ;}
Body {margin: 10% 10% 10% 10% ;}