【发布时间】:2014-04-29 09:29:33
【问题描述】:
我试图在同一行插入 4 个 div,但它们每一个都依次插入。我正在努力,但我找不到问题。我可以通过边距功能将块移动到好位置,但我认为有更好的方法。
现在看起来: picture
#recent_work {
width:952px;
margin:0 auto;
height:auto;
position:relative;
padding-top:15px;
}
#recent_work p:first-child {
font-family:Montserrat;
font-size:16px;
color:#353c3e;
width:238px;
}
#recent_work p:nth-child(2) {
font-family:Montserrat;
font-size:12px;
color:#8f8f8f;
width:190px;
line-height:25px;
}
.grey_block {
float:right;
background-color:#eaeaea;
width:230px;
height:489px;
}
.orange_block {
width:230px;
height:205px;
background-color:#e05d41;
}
.white_block {
width:230px;
height:281px;
background-color:#FFF;
}
<div id="recent_work">
<p>RECENT WORK</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis laoreet laoreet leo at dictum.</p>
<div class="grey_block">
<div class="orange_block">
<img src="img/1.png"/>
</div>
<div class="white_block">
</div>
</div>
</div>
【问题讨论】:
-
Getting 2 divs on the same line 的可能副本,在许多 others 中
-
您可以使用
span而不是span,它不会添加新行。请为它创建一个 Fiddle 演示,jsfiddle.net
标签: html css position block margin