[英]how add style for children block when we focus on link?
Code: 码:
<div id="div1">
<div class="test1"></div>
<div class="text1"><a href="#">test1</a>
</div>
<div class="test_block">text1</div>
</div>
<div id="div2">
<div class="test2"></div>
<div class="text2"><a href="#">test1</a>
</div>
<div class="">text2</div>
</div>
how make on css3 that when we focus on link(a:hover) children block test_block
get css font-size:18px
? 当我们专注于link(a:hover)子块test_block
时如何在css3上获得css font-size:18px
?
PS: For example, when we hover on link test1
font-size
for text1
will be 18 px and font-size
for text2
wiil be 14px
; PS:例如,当我们将鼠标悬停在链接test1
上时, text1
font-size
将为18 px, text2
font-size
将为14px
;
When we we hover on link test2
font-size
for text2
will be 18 px and font-size
for text1
wiil be 14px
; 当我们将鼠标悬停在链接test2
, text2
font-size
将为18 px, text1
font-size
将为14px
;
Use the adjacent sibling selector, +
: 使用相邻的兄弟选择器+
:
.text1,
.text2 {
font-size: 14px;
}
.test1:hover + .text1,
.test2:hover + .text2 {
font-size: 18px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.