<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>img</title>
<link rel="stylesheet" type="text/css" href="../static/css/171020.css">
</head>
<body>
<div class="recommand">
<div class="img">
<a href=" http://wenda.so.com/q/1369022692065247?src=140"><img src="http://p0.so.qhimgs1.com/bdr/_240_/t01b5b18fe8165f0090.jpg"></a>
<div class="desc"><a href=" http://wenda.so.com/q/1369022692065247?src=140">panda</a></div>
</div>
<div class="img">
<a href=" http://wenda.so.com/q/1369022692065247?src=140"><img src="http://img8.house365.com/szbbsuserpic/2014/01/24/139054836752e2158feac66.jpg"></a>
<div class="desc"><a href=" http://wenda.so.com/q/1369022692065247?src=140">熊猫</a></div>
</div>
<div class="img">
<a href=" http://wenda.so.com/q/1369022692065247?src=140"><img src="http://p0.so.qhimgs1.com/bdr/_240_/t01b5b18fe8165f0090.jpg"></a>
<div class="desc"><a href=" http://wenda.so.com/q/1369022692065247?src=140">啦啦</a></div>
</div>
</div>
<div>
<div>
<a href="https://www.so.com/s?q=关爱大熊猫&src=tab_image"><img src="http://p4.so.qhimgs1.com/t015a07eebcdb1726e4.jpg"></a><br>
<img src="http://p0.so.qhimgs1.com/bdr/_240_/t01b5b18fe8165f0090.jpg"><br>
<img src="http://p0.so.qhimgs1.com/bdr/_240_/t0179f4988b0dcd926c.jpg"><br>
</div>
</div>
</body>
</html>
img {
180px;
height: auto;
float: left;
}
.img{
border: 2px solid #ccc;
180px;
float: left;
padding: 30px;
height: auto;
margin: 30px;
}
div.img img{
100%;
height: auto;
padding: 20px;
}
div.desc{
text-align: center;
padding: 20px;
}
div.img:hover{
border: 1px solid #110000;
}
div clearfloat{
clear: both;
}
- 认识CSS的 盒子模型。
- CSS选择器的灵活使用。
- 实例:
- 图片文字用div等元素布局形成HTML文件。
- 新建相应CSS文件,并link到html文件中。
- CSS文件中定义样式
- div.img:border,margin,width,float
- div.img img:width,height
- div.desc:text-align,padding
- div.img:hover:border
- div.clearfloat:clear