[英]“And” Selector in CSS With :hover
I am trying to allow a object to move down if either the bar or sidebar are hovered. 如果栏或侧栏悬停,我试图允许对象向下移动。 I am trying the following code: 我正在尝试以下代码:
#sidebarcategoryshow:hover#sidebar:hover #sidebarcategoryshow{
margin-top: 200px;
z-index: 5;
-webkit-transition: 1s linear;
-moz-transition: 1s linear;
-o-transition: 1s linear;
-ms-transition: 1s linear;
transition: 1s linear;
}
And basically I want #sidebarcategoryshow to move down if either one is hovered. 基本上,我希望#sidebarcategoryshow如果任何一个都悬停了,请向下移动。 Yet this does not seem to work, any idea? 但这似乎行不通吗? :( Currently it just is not working like it should. :(目前,它无法正常工作。
You would need to use two separate selectors: 您将需要使用两个单独的选择器:
#sidebarcategoryshow:hover #sidebarcategoryshow,
#sidebar:hover #sidebarcategoryshow {
margin-top: 200px;
z-index: 5;
-webkit-transition: 1s linear;
-moz-transition: 1s linear;
-o-transition: 1s linear;
-ms-transition: 1s linear;
transition: 1s linear;
}
If you are using LESS , you could use the following: 如果使用LESS ,则可以使用以下命令:
#sidebarcategoryshow, #sidebar {
&:hover #sidebarcategoryshow {
/* ... */
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.