在CSS中并排堆叠Divs [英] Stacking Divs side by side in CSS
问题描述
我不想在这里求助,但经过数小时的挫折后,我觉得我必须这样做!
I didn't want to resort to asking here but after hours of frustration I feel I have to!
我有两个(可能更多)的div要肩并肩。他们的父级div具有固定的宽度,并且 overflow:hidden
,因此我们一次最多只能看到一个div。问题是它们不会并排堆叠!我试过 float:left
和 display:inline
无济于事。
I have two (could be more) divs that I want side by side. Their parent div has a fixed width and overflow:hidden
so we can see at most one div at a time. The problem being is that they will not stack side by side! I've tried float:left
and display:inline
to no avail.
有一个我在此处
任何帮助将不胜感激!
推荐答案
div
#tab_container{
width:2000px;
}
然后给您的浮动对象足够的空间可以并排浮动,目前他们没有没有足够的空间,因此默认的浮动行为会将其强制到下一行。
Which then gives your floats enough space to float side by side, currently they don't have enough room and so default float behaviour forces them to the next line.
这篇关于在CSS中并排堆叠Divs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!