Home > Article > Web Front-end > Complete the storage example of div position through css layout
CSS+DIV
Encapsulate data into divs. The page is composed of many divs. The storage of these div positions is completed through css layout (through css attribute layout). A div is a box. .
border:{
——left
——right
——top
——bottom
};
#div_1{
border-top:1px solid #ccc;
border-bottom:1px dashed #ccc;
border -right:1px dotted #ccc;
border-left:1px double #ccc;
};
solid:solid line
dashed:dashed line
dotted:dotted line
double:double line
Padding/Padding
Attribute: padding{
——top
——bottom
——right
——left
#};
padding: 20px 20px 20px 20px;
Margin
margin attribute{
--top
--bottom
——right
——left
};
margin:20px 20px 20px 20px
In the div, if the margin is 0,px , why is there still a blank space? The blank space is the distance between the body itself and the browser border.
So you need to set body{margin:0px};
Browsers parse the body in different ways, resulting in different widths and widths.
The above is the detailed content of Complete the storage example of div position through css layout. For more information, please follow other related articles on the PHP Chinese website!