两个 inline-block 标签之间如果有空白,则会有显示上的间距
解决办法:
1.使用float 代替 inline-block
2.在inline-block 的上层容器添加 font-size:0px
3.删除两个标签之间的空白
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="gbk">
<style type="text/css">
#content {
font-size: 0px;
width: 1190px;
border: 1px solid gray;
height: 200px;
margin: 0px auto;
}
.first {
height: 100px;
background-color: blue;
display: inline-block;
width: 190px;
}
.second {
height: 100px;
background-color: red;
display: inline-block;
width: 790px;
margin-left: 10px;
}
.third {
height: 100px;
background-color: green;
display: inline-block;
width: 200px;
}
</style>
</head>
<body>
<div id="content">
<div class="first">第一个</div>
<div class="second">第二个</div>
<div class="third">第三个</div>
</div>
</body>
</html>