简体   繁体   English

将父类的悬浮式CSS隐含到其子标记悬浮式CSS

[英]Impliment parent class's hover css to its child tag hover css

In my scenario, i want to call css of parent class's child tag hovering css on hovering of parent css. 在我的场景中,我想在父类CSS悬停时调用父类的子标签css悬停CSS。

here is my JSFiddle 这是我的JSFiddle

I want to call the css of .videos-holder figure figcaption:hover on hover of .videos-holder figure:hover 我想在.videos-holder figure figcaption:hover上调用.videos-holder figure figcaption:hover的css .videos-holder figure:hover

Is it possible to do this without adding new IDs and Classes? 是否可以在不添加新ID和类的情况下执行此操作? Btw, my main purpose is to change color of <figcaptio> on hovering on <figure> . 顺便说一句,我的主要目的是将<figcaptio>悬停在<figure> <figcaptio>更改<figcaptio>颜色。

.videos-holder figure  figcaption:hover{
    -webkit-filter: grayscale(0%); 
    filter: grayscale(0%);
     -webkit-transition: .2s; /* Safari */
    transition: .2s;
}

Replace to

.videos-holder figure:hover  figcaption{
    -webkit-filter: grayscale(0%); 
    filter: grayscale(0%);
     -webkit-transition: .2s; /* Safari */
    transition: .2s;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM