Possible Duplicate:
How do I select the “last child” with a specific class name in CSS?
正如标题所说,我想将CSS规则添加到具有特定类的特定类型的最后一个元素.以下代码可以完美地运行:
div:last-of-type { margin-right:0; }
但我想要的是
div.class:last-of-type { margin-right:0; }
怎么做?
Possible Duplicate:
How do I select the “last child” with a specific class name in CSS?
正如标题所说,我想将CSS规则添加到具有特定类的特定类型的最后一个元素.以下代码可以完美地运行:
div:last-of-type { margin-right:0; }
但我想要的是
div.class:last-of-type { margin-right:0; }
怎么做?
不幸的是,用last-of-type
找不到最后.class
个.
Edit:
要真正给这个答案添加一些建设性的东西,您可以退回到JavaScript来定位这个 Select 器,或者修改您的标记/CSS.虽然我发现自己处于这样一种情况:对于类 Select 器来说,last-of-type
会很有用,但只要多花点心思,没有什么是不能解决的.