下面的代码中,当两个标签处于同一行则布局成功,当标签换行,则布局失败相应的也换行。当然如果我将其改成右79%左边20%则布局成功~求解
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.left, .right, .bottom {
height: 100px;
}
.left {
width:20%;
background: red;
}
.right {
background: blue;
}
.bottom {
background: yellow;
}
.left,.right {
display:inline-block;
}
.right {
width:80%;
}
</style>
</head>
<body>
<div class="main">
<div class="left">DIVA</div><div class="right">DIVB</div> //标签不换行,ok
</div>
<div class="bottom">DIVC</div>
<div class="main">
<div class="left">DIVA</div>
<div class="right">DIVB</div> //标签换行 ,布局失败
</div>
<div class="bottom">DIVC</div>
</body>
</html>
这是display:inline-block的空白间隙问题