每个div包含不同长度的列表,因为我使用的是内嵌块。我认为这是导致它沿着最高处的div
的底部对齐。如何将这些div沿顶部水平对齐?
有没有一种方法,我可以调整这些div
沿着顶部或者我需要给每个div
独特的id
和style
它们各自相应的?
我在这里做一个小提琴: http://jsfiddle.net/Bezzzo/dcqmh2g2/1/
HTML
<!-- footer -->
<div id="footer" >
<!--Community div-->
<div>
<h3>Community</h3>
<ul>
<li>Facebook</li>
<li>Twitter</li>
<li>Tumbler</li>
<li>Google plus</li>
</ul>
</div>
<!--Contact support div-->
<div>
<h3>Contact support</h3>
<ul>
<li>[email protected]</li>
</ul>
</div>
<!--Legal div-->
<div>
<h3>Legal</h3>
<ul>
<li>Terms and conditions</li>
<li>Refund policy</li>
<li>Privacy Policy</li>
</ul>
</div>
</div>
CSS
#footer {
position: relative;
width:1033px;
height: 160px;
margin:auto;
border-style:dashed;
}
#footer div {
display:inline-block;
position: relative;
margin-left: 150px;
border-style:dashed;
}
#footer ul {
list-style-type: none;
padding:0px;
margin:0px;
left:0px;
right:0px;
}
谢谢
完美!我发誓我试过了,也许我把它放在了错误的元素中。谢谢 – user3796133
@ user3796133请点击正确答案旁边的勾号将问题标记为已解决。谢谢。 –
我会的,虽然有一个时间限制,我可以接受你的答案,仍然2分钟等待“耐心,你必须有我的年轻padawan”:-) – user3796133