我想排列多个div。 我已经搜索了stackoverflow和基于我的代码:How to align two divs side by side using the float, clear, and overflow elements with a fixed position div/。排列多个div并排
我打得与它周围,并结束了这个CSS:
.frontpageBoxLeft, .frontpageBoxRight {
border-radius: 5px;
border-color: lightgrey;
background: #ffffff;
height: 150px;
}
.frontpageBoxLeft {
margin-bottom:15px;
width: 750px;
min-height: 100px;
position: relative;
}
.frontpageBoxRight {
width: 320px;
float: right;
height: 300px;
position: relative;
vertical-align: top;
}
.frontpageBoxContainer {
width: 70%;
height: 500px;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
和这个网站:
<div class="frontpageBoxContainer">
<p class="newsfeedheadline">NEWS FEED</p>
<hr class="hrstarter">
<div class="frontpageBoxLeft" id="1">
et eksempel på en kasse1
</div>
<div class="frontpageBoxLeft" id="2">
et eksempel på en kasse2
</div>
<div class="frontpageBoxLeft" id="3">
et eksempel på en kasse3
</div>
<div class="frontpageBoxRight">
et eksempel på en anden kasse
</div>
</div>
结果是这样的:
我想能够把多个div放在左边,而多个div放在 右边。 现在,当iam只使用一个右侧和一个左侧div时,代码工作正常,但是具有多个div时,它的行为与图片中相似。
此致敬礼。
请你分享一下你的代码,已经采取了上面的截图?它看起来像我所需要的,但是当我尝试使用您提供的CSS时,我得不到相同的结果。 – Tony
http://codepen.io/valeri879/pen/yaQYVK 这里是代码 –
谢谢你的作品完美! – Tony