1 标签案例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>实际案例</title>
<style type="text/css">
body {
background-color: aliceblue;
}
* {
padding: 0;
margin: 0;
}
.box {
height: 365px;
width: 215px;
background-color: pink;
/* 盒子居中显示 */
margin: 100px auto;
background-color: white;
}
.box .img1 {
width: 100%;
}
.word {
font-size: 15px;
height: 60px;
padding: 0 28px;
margin-top: 20px;
}
.suggest {
font-size: 12px;
color: #b0b0b0;
margin-top: 10px;
padding: 0 28px;
}
.info {
margin-top: 10px;
padding: 0 28px;
font-size: 15px;
}
.info h4 {
display: inline-block;
font-weight: 400;
}
.info span {
color: red;
}
.info em {
font-style: normal;
color: #B0B0B0;
margin: 0 5px 0 3px;
}
a {
text-decoration: none;
color: black;
}
</style>
</head>
<body>
<div id="" class="box">
<img src="../image/one.png" class="img1">
<p class="word"><a href="#">短袖T恤女装2021年夏季新款宽松短款薄款抽绳设计感小众...</a></p>
<div id="" class="suggest">
来自12000条评论
</div>
<div class="info">
<h4> <a href="#">潮牌韩版衣服...</a></h4> <em>|</em>
<span id="">85元</span>
</div>
</div>
</body>
</html>
![](https://i-blog.csdnimg.cn/blog_migrate/e2491cc5cb4f95aee09934d5d55a83cd.png)
2 注意事项,两个块级元素一行显示float
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ddd</title>
<style type="text/css">
.one {
width: 300px;
height: 100px;
background-color: #FD3F31;
margin: 100px auto;
}
.left {
width: 150px;
height: 100px;
background-color: pink;
float: left;
}
.right {
width: 150px;
height: 100px;
background-color: black;
display: inline-block;
}
</style>
</head>
<body>
<div id="" class="one">
<div id="" class="left">
</div>
<div id="" class="right">
</div>
</div>
</body>
</html>
![](https://i-blog.csdnimg.cn/blog_migrate/978321be27520b5bb7cae2e0fbbd7236.png)