gpt4 book ai didi

css - 如何使用 myabilities 类访问第一个元素?

转载 作者:行者123 更新时间:2023-11-28 12:18:15 25 4
gpt4 key购买 nike

如何在下面给出的代码中访问带有 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>

最佳答案

不幸的是像:nth-child这样的伪类和 :nth-of-type只会根据 type 查找元素,而不是您可能期望的它们的类或 ID 值。但是考虑到您的标记(假设它不会改变)您可以选择使用:

div.span6 .srvc-detail + p {
color: gold;
}

http://jsfiddle.net/E3GSV/3/

关于css - 如何使用 myabilities 类访问第一个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18299471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com