如何使用删除最后一个 DIV 的背景class="item"?
父母是:<div id="lastQuestions"></div>
或者,您可以为元素使用不同的 html 标记(如或显示为块),span而不是将它们与其他元素区分开来,然后您可以执行以下操作:pli.itemdivdiv
#lastQuestions li:last-of-type {
background: none;
}
选择它。
因为,根据您的jsfiddle,您的代码中只有.item元素是类型div的,它们的类型已经与#lastQuestions. 所以你可以试试这个:
#lastQuestions > div:last-of-type {
background: none;
}