【发布时间】:2014-03-30 00:55:27
【问题描述】:
【问题讨论】:
-
请贴出代码..
-
你能创建一个jsfiddle吗?调试jsfiddle.net会更容易
标签: css
【问题讨论】:
标签: css
列表是可能的:
<ul class="list">
<li>
<div class="box">
<span class="icon"></span>
<div class="container">
<h2>Headline</h2>
<small>Description is small.</small>
</div>
</div>
</li>
</ul>
CSS:
.list {
list-style: none;
margin: 0;
padding: 0;
}
.box > :first-child {
background-color: #000;
float: left;
height: 48px;
width: 48px;
}
.box > :not(:first-child) {
margin-left: 60px;
}
h2 {
margin-bottom: 0;
}
small {
display: inline-block;
}
【讨论】:
div.box可以去掉,规则可以用ul.list > li代替。
code .box > li:nth-child(2) { background-image: url(img/shop-icon.png); } code 但根本不起作用!有什么注意事项吗?
li元素内,因此它必须是li:nth-child(2) > .box。