我想创建一个真正的基本布局与两个div。这个想法是在同一行中有一个div在左边,另一个在右边。但是他们没有相同的高度。对齐顶部
为什么较小的div对齐而不是顶部?这不是页面流中的预期行为吗?
<body>
<div>
<div class="left debug-green"></div>
<div class="right debug-red"></div>
</div>
</body>
body {
font-size: 0;
}
.left {
width: 50%;
height: 30px;
display: inline-block;
}
.right {
width: 50%;
height: 20px;
display: inline-block;
}
.debug-red {
background-color: rgb(255, 0, 0);
}
.debug-green {
background-color: rgb(0, 255, 0);
}
这是一个js小提琴样本:
但是,div背后的原因是什么?是在某个地方定义该值的css规范? – andymaster01