我有这样的HTML:这两个DIV为什么不对齐?
<div class="s0">
<div class="s1"></div><div class="s2">Some text</div>
</div>
这个CSS:
.s0 {
width:300px;
background-color:gray;
}
.s1 {
width:150px;
height:100px;
display:inline-block;
background-color:blue;
margin-right:10px;
}
.s2 {
width:140px;
height:100px;
display:inline-block;
background-color:green;
}
如果测试此代码,你会看到两个div不对齐。如果我删除从绿色DIV问题消失文本 http://jsfiddle.net/memanuele/aUdPs/2/
:
您可以在这里检查了这一点。
有人能解释我为什么会发生这种情况吗?对不起,如果这已被问到,但我找不到在任何其他问题完全相同的问题。
在此先感谢。
可能会更容易漂浮的div –
http://jsfiddle.net/aUdPs/4/ - 带花车 – aldanux