当我将无序列表格式化为内嵌块时,如果其他元素具有任何块内容,则列表中的最后一个列表元素似乎具有额外的顶部边距。看看这个HTML:列表元素的CSS格式具有不正确的边距
<div id="report_builder">
<ul id="report_layout_1" class="report_layout ui-droppable">
<li rel="recid">Id
<div><input type="text" class="report-column-value"></div>
</li>
<li rel="street1">Address
<div><input type="text" class="report-column-value"></div>
</li>
<li>
Last Field
</li>
</ul>
</div>
这里是CSS:
#report_builder li {
font-size: 8pt;
}
#report_builder > ul {
float: left;
}
.report_layout {
height: 150px;
}
.report_layout > li {
display: inline-block;
padding: 5px;
margin-left: 2px;
border: 1px solid #ccc;
border-top: 10px solid #ccc;
height: 100px;
background-color:#fff;
}
.report_layout > li:last {
cursor: default;
}
.report_layout > li a {
cursor: pointer;
}
.report_layout > li:nth-child(even) {
background-color:#eee;
}
#report_builder input.report-column-value {
width: 95px;
}
为什么这最后一个列表元素下拉?这是一个fiddle来演示我在做什么。
这是正确的答案。将'vertical-align:top;'添加到'.report_layout> li' – 2012-03-14 19:27:17
这就是我错过的!非常感谢。 – davidethell 2012-03-14 19:32:37