对齐2个div [英] Align 2 divs side by side
问题描述
我需要并排排列2个div。它们都在一个没有设置高度的包装器div内。
我的问题是当我分别使用float:left和float:right时,div不出现保持在内部的封装div(我可以告诉作为封装div有不同的背景颜色的页面,这不是扩展到覆盖我想要定位的2个div)。
基本上,我需要两个div并排,但在此包装器中。
[很穷]尝试描述这个问题,我不做很多设计工作。
向封装div添加 overflow:hidden
>
I need to align 2 divs side by side. They are both inside of a wrapper div that has no set height.
My problem is when I use float:left and float:right respectively, the div's don't appear to "stay inside" the wrapper div (I can tell as the wrapper div has a different background colour to the page and this isn't being extended to cover the 2 divs I want to position).
Basically I need the 2 div's to be side by side, but WITHIN this wrapper.
Apologies for the [very poor] attempt at describing this problem, I don't do much design work.
Add overflow:hidden
to the wrapper div.
这篇关于对齐2个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!