<body>
<div id="main1">
<header>
<img src="http://www.todayhot.com.cn/template/cmsoft_discover_140627/cmsoft/logo.png" alt="">
<div class="header-nine">
<span>26℃-37℃ 小雨<span>
</div>
<!-- 搜索框 -->
<span></span>
<input type="text" placeholder="搜索一下">
<span></span>
<span></span>
<span></span>
</header>
<nav>
<div id="list"> </div>
<ul id="u1">
<li><a href="" style="background:aquamarine;">推荐</a></li>
<li><a href="">新闻</a></li>
<li><a href="">娱乐</a></li>
<li><a href="">军事</a></li>
<li><a href="">社会</a></li>
<li><a href="">体育</a></li>
<li><a href="">科技</a></li>
<li><a href="">汽车</a></li>
<li><a href="">财经</a></li>
<li><a href="">游戏</a></li>
<li><a href="">房产</a></li>
<li><a href="">生活</a></li>
</ul>
</nav>
<main>
<div>
<img src="./2.jpg" alt="">
<p>定制实木橱柜的好处定制
实木橱柜怎么选</p>
</div>
<div>
<img src="./3.jpg" alt="">
<p>25岁美女寡妇口述 : 单身3
年,晚上找我帮忙.</p>
</div>
<div>
<img src="./4.jpg" alt="">
<p>温莎城堡 “私家花园” 活
动圆满结束</p>
</div>
<div>
<img src="./5.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./HomePage.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./classmates.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./header.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./hometown.JPG" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./html5.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./lzu.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./2.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
<div>
<img src="./3.jpg" alt="">
<p> 别人新房像好宅,我35平
新房像“火柴” ,日式胶</p>
</div>
</main>
</div>
</body>
<style>
*{
margin:0;
padding: 0;
list-style: none;
}
body,header,nav,main{
margin: 0 auto;
width: 800px;
}
body{
background-color: #000;
}
#main1{
width: 800px;
height: 650px;
border: 1px solid #eee;
background-color: #fff;
margin: 50px auto;
position: relative;
}
header{
height: 70px;
/* background-color: chocolate; */
}
header img{
width:400px;
height: 68px;
}
.header-nine{
display: inline-block;
}
.header-nine span{
font-size: 18px;
position: absolute;
margin: -39px 35px 0;
color: #333;
}
.header-nine span:hover{
color: lightgreen;
background: pink;
border-radius: 10px ;
}
header input{
position: absolute;
right: 0;
margin: 30px 20px;
width: 150px;
height: 20px;
border: 1px solid #ccc;
background-color: #eee;
}
nav{
height:50px;
background-color: rgb(240, 236, 236);
margin: 10px 0 0 ;
}
nav .u1{
display: inline-block;
}
nav li{
display: inline-block;
padding: 0 15px;
line-height: 50px;
}
nav li a{
color: #000;
text-decoration: none;
}
nav li a:hover{
color: red;
text-decoration: underline;
}
main{
width: 800px;
height: 500px;
/* border: 1px solid black; */
display: flex;
flex-wrap: wrap;
justify-content: space-between;
/* align-content: space-between; */
justify-content: space-around;
margin: 20px auto;
}
main div{
width: 170px;
height: 90px;
/* border: 1px solid red; */
}
main div p{
text-indent: 2em;
}
main div p:hover{
/* border: 1px solid rgb(58, 92, 194); */
color: #fff;
background: rgb(7, 89, 240);
opacity: 0.5;
}
main img{
width: 170px;
height: 90px;
}
#list{
background-color: aquamarine;
height: 50px;
position: absolute;
top: 0;
transition: all 0.3s;
}
</style>
主要部分用弹性布局样式每一块都是一样的算是个小练习,