如何在下面给出的代码中使用myabilities类访问第一个元素?
<div class="span6">
<h3 class="srvc-title">Responsive Design</h3>
<p class="srvc-detail">Crafting great experiences to suit the capabilities of every browser.</p>
<p class="myabilities">The number of web-accessible devices is truly a wonder of our information age. It’s also a daunting canvas for design.</p>
<p class="myabilities">Mobile phones, tablets, desktops — it’s hard to even categorise these days. I specialise in embracing the Web’s ubiquity. It’s my job to design for all experiences.</p>
<p class="myabilities">Great design can’t be achieved in isolation. In fact, it’s two development practices that are the secret; feature detection and progressive enhancement. That means a multi-tiered design to match the capabilities of any browser.</p>
<p class="myabilities">Complicated for us but for users — it just works.</p>
</div>
答案 0 :(得分:1)
不幸的是,:nth-child
和:nth-of-type
之类的伪类只会查找基于type的元素,而不是像您可能期望的那样查找其类或ID值。但鉴于你的加价(假设它不会改变)你可以选择使用:
div.span6 .srvc-detail + p {
color: gold;
}