为什么我的div在满足的情况下比其他的低?

Jas*_* Yu 2 html css

我一直在尝试 div 溢出。我遇到了 div 未“正常”显示的问题。这是一个简单的 HTML 和 CSS,我希望有人能解释我的问题吗?

我期望这些框显示在同一行中。

<div class='content'>
  <div class='box'>
    hihi
  </div>
  <div class='box'>
  </div>
</div>
...
Run Code Online (Sandbox Code Playgroud)

http://codepen.io/ycmjason/pen/xbXpmV/

小智 5

您缺少vertical-align: top;上的财产box class

它应该是:

.box{
    display:inline-block;
    **vertical-align: top;**
    width:50px;
    height:50px;
    margin-left:15px;
    background: #55CC55;
}
Run Code Online (Sandbox Code Playgroud)