html - 将父类 hover css 实现到它的子标签 hover css

标签 html css

在我的场景中,我想调用父类的子标签的 css hovering css on hovering of parent css。

这是我的 JSFiddle

我想调用.videos-holder figure figcaption:hover的css悬停在 .videos-holder figure:hover

是否可以在不添加新 ID 和类的情况下执行此操作?顺便说一句,我的主要目的是改变 <figcaptio> 的颜色悬停在 <figure> 上.

最佳答案

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

替换为

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

关于html - 将父类 hover css 实现到它的子标签 hover css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45738670/

相关文章:

javascript - 动态表单到数据库

javascript - 单击两个输入的相同标签名称的关闭图标时取消选中选中的输入

javascript - 链接被 JS 隐藏

python - 将 HTML 实体转换为 Python 表情符号

将在主要浏览器和屏幕尺寸 iPhone 及更大屏幕上正确呈现的 HTML

javascript - 缩小 PhoneGap App 的代码?

javascript - 如何使scrollIntoView()在第一次点击时起作用(Angular 6)?

CSS占用剩余空间

python - 在 Django 中链接静态文件目录

css - 使用位置固定的问题