这是我尝试处理的html代码。我需要突出显示Chaz的第三个引用块。我不应该使用id或class来做到这一点。
<aside id="left">
<h2>What they're saying about us</h2>
<blockquote title="testimonials">
<p>"CSS coding is endlessly fun. I have such a great time doing it."</p>
<cite>DGMD student</cite>
</blockquote>
<blockquote>
<p>"I will be so glad when this assignment is over. "</p>
<cite>Another student</cite>
</blockquote>
<blockquote>
<p>"Do you really need so many classes and IDs after learning these cool selectors?"</p>
<cite>Chaz</cite>
</blockquote>
</aside>
这是我创建的css代码,但是我应该使用:not选择器来完成此问题,并且每次尝试使用它时都不会改变。
blockquote:last-of-type cite {
background-color: purple;
font-style: normal;
color: white;
}
这个问题似乎建议您对所有blockquote
元素都加:not()
亮显示,然后在对前两个元素进行过度样式化时使用CSS选择器,而不是选择最后一个元素。困惑?例如...
aside blockquote {
background-color: pink;
}
aside blockquote:not(:last-of-type) {
background-color: white; /* or page background-color */
}
希望有帮助:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句