html - 两个内联 block 未对齐

标签 html css

我在 container div 中有两个 div:JS Fiddle Link

<div id="container">
    <div class="leftContainer">
        Left
    </div>
    <div class="rightContainer">
        <h3>Right</h3>
    </div>
</div>

但我不确定为什么它们不与顶部对齐或与此 CSS 具有相同对齐方式的任何地方:

div#container{vertical-align:top;background:#e4e4e4}

div#container div{
  display:inline-block;
  width:200px;
  height:50px;

}
div#container div.leftContainer{background:#999}
div#container div.rightContainer{background:#555}

最佳答案

#container div 的子元素添加 vertical-align:top;

   div#container div{
    vertical-align:top;
    }

关于html - 两个内联 block 未对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27837904/

相关文章:

javascript - 在 Jquery 中呼唤 child

html - Sublime Text 2 : Autocompleting html escaped characters (starting with ampersand)?

html - 将文本与居中的图标对齐

jquery - 打开/关闭时图像变化

javascript - 尝试添加 slideToggle() 函数但它不起作用

jquery - 二次点击绑定(bind)解绑问题

javascript - meteor 现场 Accordion 菜单

html - 图像损坏并在屏幕上显示 css 代码

html - 对齐网页上的复杂图像

css - 简单的全屏CSS slider