这是我的问题的图像:
渲染页面截图 http://cl.ly/image/0E2N1W1m420V/Image%202012-07-22%20at%203.25.44%20PM.png
我的第一个错误是横幅和“网页设计”之间有大量空白div
。我的第二个错误是“Web Development”div
应该在“Web Design”旁边div
。这些div
s 的宽度都指定为 23%,我尝试使用该float
属性,但这也不起作用。
HTML:
<div id="maininfo">
<div id="eyediv">
<li><a class="eye"></a></li>
<h1>Web Design</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut lacinia condimentum dignissim. Suspendisse potenti. Nunc in metus id lorem accumsan vehicula. Proin posuere lacus id odio tincidunt mattis sit amet et sapien. Nulla facilisi. Quisque sodales risus eget mauris adipiscing vitae scelerisque metus mattis. Praesent lectus purus, feugiat eleifend faucibus nec, volutpat sed eros. Praesent quis ante pharetra mauris pretium porttitor.</p>
<button type="button">SEE MORE</button>
</div>
<div id="spannerdiv">
<li><a class="spanner"></a></li>
<h1>Web Development</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut lacinia condimentum dignissim. Suspendisse potenti. Nunc in metus id lorem accumsan vehicula. Proin posuere lacus id odio tincidunt mattis sit amet et sapien. Nulla facilisi. Quisque sodales risus eget mauris adipiscing vitae scelerisque metus mattis. Praesent lectus purus, feugiat eleifend faucibus nec, volutpat sed eros. Praesent quis ante pharetra mauris pretium porttitor.</p>
<button type="button">SEE MORE</button>
</div>
CSS:
#maininfo {
clear: both;
}
#maininfo li {
list-style: none;
}
#eyediv {
margin-left: 15%;
width: 23%;
}
#spannerdiv {
width: 23%;
padding-left: 3px;
float: left;
}