我希望将这三个图像并排对齐,并将div与id菜单对齐。
HTML
<div id="menu">...</div>
<div class="l-grid">
<ul>
<li class="l-col l-size1of4">
<div id="location">
<img alt="Tell us your locaiton" src="images\location.jpeg" />
</div>
</li>
<li class="l-col l-size1of4">
<div id="delivery">
<img alt="Choose menu to be delivered" src="images\dial\location.jpeg" />
</div>
</li>
<li class="l-col l-size1of4">
<div id="payment">
<img alt="Payment mode" src="images\dial\payment.jpeg" />
</div>
</li>
</ul>
</div>
CSS
.l-col {
float: left;
}
.l-size1of4 {
width: 166px;
}
相邻的图片必须在页面中并且在div id main之后。
答案 0 :(得分:3)
将ul li.l-col
设置为display:inline-block
:
.l-col{
display: inline-block;
}
JS小提琴: http://jsfiddle.net/mR64t/
答案 1 :(得分:0)
尝试对所有.l-col类使用width,
li.l-col {
display: inline;
}
或强>
.l-col {
float: left;
width: 166px;
}