我想申请样式的div [class*="high-"]
p
孩子徘徊(任何DIV开始高)时,但不是所有p
孩子,只有徘徊里面的一个家长。如果没有jQuery需要,更好。
HTML:
<div class="high-venas">
<p><strong>Venas y varices</strong><br>
<span>Lorem ipsum dolor sit amet</span></p>
</div>
<div class="high-cirugiaCalvicie">
<p><strong>Cirujía calvicie</strong><br>
<span>Lorem ipsum dolor sit amet nonummy nibh </span></p>
</div>
CSS:
#highlights p {
background-color: white;
opacity:0.7;
}
,因为我已经没有结果尝试这些例子到这里,我认为这可以通过选择造成的,也许它是当鼠标悬停在以“高”开头的div时不会识别:
div [class*="high-"]:hover > div > p {
opacity:1;
}
[class*="high-"]:hover > div > p {
opacity:1;
}
你试过了吗? div [class * =“high - ”]:hover p {opacity:1; } – giordanolima 2014-10-02 16:08:35
这两个选择器都是错误的 - 第一个选择器在元素和属性选择器之间有空格(以便在div的_child_元素上查找具有该类的元素),第二个尝试查找首先使用该类的元素下的div,这不在实际的元素结构中。 – CBroe 2014-10-02 16:09:45
现场演示在帖子上添加 – Biomehanika 2014-10-02 16:20:28