Example requirements: A box has more than one picture, the picture's margin consistent, and can automatically wrap, to achieve the picture window effect. The final effect figure is shown at the end of the article.
Realize the idea:
Basic structure:
<div>
<ul>
<li></li>
</ul>
</div>
HTML file:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
"Http://www.w3.org/TR/html4/loose.dtd" >
<title> Untitled Document </title>
<link rel= "stylesheet" type= "Text/css" href= "Test.css"/>
<body>
<!--This div plays the role of controlling the entire content display position in the layout-->
<div class= "CLS1" >
<!--How many--> the UL controls the display content in the layout
<ul class= "Faceul" >
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
CSS file:
. cls1{
width:500px;
height:300px;
border:1px solid Gray;
}
. faceul{
width:300px;
height:250px;
border:1px solid red;
padding-left:5px; Left margin in/*ul * *
margin-left:10px;
}
. Faceul li{
list-style-type:none;/* remove the small point.
Float:left; /* Left float, to achieve horizontal arrangement * *
width:50px;
height:52px;
border:1px solid red;
margin-right:5px;
margin-top:5px;
}
. Faceul Li Img{
width:40px;
height:40px;
margin-left:5px;
margin-top:5px;
}
The effect of the following figure:
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/Css/