CSS Box Model instance

Source: Internet
Author: User

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/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.