如何对齐两个DIV的顶行? [英] How to align the top lines of two DIVs?
本文介绍了如何对齐两个DIV的顶行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让两个DIV(< div>< / div>
)的顶行水平对齐,如何处理?
I want the top lines of two DIVs (<div></div>
) to be aligned horizontally, how to do it?
推荐答案
为了回应是否有另一种方法,请确保您可以使用 display:inline
但你有一堆黑客记住,让它工作在IE6 / 7。
In response to "is there another way to do it", sure you could use display: inline
but you have a bunch of hacks to remember to get it to work in IE6/7. This way is generally better (but it all comes down to the individual circumstances)
<style type="text/css">
.keeper {
overflow: hidden; /* expand to contain floated children */
}
.keeper div {
width: 200px;
height: 30px;
float: left;
border-top: 1px solid red; /* so you can see the 'tops' */
}
</style>
<div class="keeper">
<div>
</div>
<div>
</div>
</div>
这篇关于如何对齐两个DIV的顶行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文