1

我在 wordpress 上运行这个网站,列表是由插件生成的,但是我似乎无法更改最后一个 li 标签上的任何样式。

HTML

<div class="home">
    <p></p>
    <h4><li><a class="wp-super-faq-question-closed" id="wp-super-faq-question--0" href="http://www.statics-wanted.co.uk/statics4cash/?wp_super_faq=earn-an-extra-750-for-your-static-genuine-additional-bonus" title="…Earn an Extra £750* for your static, Genuine Additional Bonus!!!”" rel="question"><span class="wp-super-faq-triangle">▶&lt;/span> …Earn an Extra £750* for your static, Genuine Additional Bonus!!!”&lt;/a></li></h4>
    <div class="wp-super-faq-answer" id="wp-super-faq-question--0-answer" style="zoom: 1; display: none;">Enter answer here</div>
    <h4><li><a class="wp-super-faq-question-closed" id="wp-super-faq-question--1" href="http://www.statics-wanted.co.uk/statics4cash/?wp_super_faq=you-want-to-sell-your-static-fast-and-for-as-much-as-possible" title="“…You want to sell your static FAST and for as much as possible.”" rel="question"><span class="wp-super-faq-triangle">▶&lt;/span> “…You want to sell your static FAST and for as much as possible.”&lt;/a></li></h4>
    <div class="wp-super-faq-answer" id="wp-super-faq-question--1-answer" style="zoom: 1; display: none;">Enter answer here</div>
    <h4><li><a class="wp-super-faq-question-closed" id="wp-super-faq-question--2" href="http://www.statics-wanted.co.uk/statics4cash/?wp_super_faq=85-of-customers-received-more-money-by-using-us" title="“…85% of customers received more money by using us.”" rel="question"><span class="wp-super-faq-triangle">▶&lt;/span> “…85% of customers received more money by using us.”&lt;/a></li></h4>
    <div class="wp-super-faq-answer" id="wp-super-faq-question--2-answer" style="zoom: 1; display: none;">Enter answer here</div>
    <h4><li><a class="wp-super-faq-question-closed" id="wp-super-faq-question--3" href="http://www.statics-wanted.co.uk/statics4cash/?wp_super_faq=we-have-over-98-customer-satifaction" title="“…We have over 98% customer satifaction.”" rel="question"><span class="wp-super-faq-triangle">▶&lt;/span> “…We have over 98% customer satifaction.”&lt;/a></li></h4>
    <div class="wp-super-faq-answer" id="wp-super-faq-question--3-answer" style="zoom: 1; display: none;">Enter answer here</div>
    <h4><li><a class="wp-super-faq-question-closed" id="wp-super-faq-question--4" href="http://www.statics-wanted.co.uk/statics4cash/?wp_super_faq=last-year-we-spent-over-1million-buying-static-caravans" title="…Last year we spent over £1million buying Static Caravans" rel="question"><span class="wp-super-faq-triangle">▶&lt;/span> …Last year we spent over £1million buying Static Caravans</a></li></h4>
    <div class="wp-super-faq-answer" id="wp-super-faq-question--4-answer" style="zoom: 1; display: none;">Enter answer here</div>
    <p></p>
</div>

CSS

.home li {
    list-style:url(../images/fact.png);
}
.home h4 li:nth-child(5) {
    padding-top:20px
}

JSFiddle 链接

非常感谢

4

2 回答 2

0

问题是 li 不是第 n 个孩子,它们都在一个<h4>元素中。如果您使用:

.home h4:nth-child(10) li {padding-top: 20px;}

这应该可以解决问题

于 2013-08-16T11:18:22.050 回答
0

你可以创建一个CSS类

li.last-item { /* ... */ }

并将其应用于您的最后一个列表项。

于 2013-08-16T11:22:53.733 回答