如何从 a:link、a:visited、a:active 继承到 .menunav:hover
我有这样的代码
a:link, a:visited, a:active {
color: white !important;
text-decoration: none !important;
}
.menunav:hover {
color: white !important;
text-decoration: none !important;
background: #333;
transition-duration: 0.5s;
}
我要继承
颜色:白色!重要;
文本装饰:无!重要;
最佳答案
要在第二个元素类型中使用这些属性,您可以像上面那样将属性复制粘贴到第二个规则中,或者让选择器出现在两个规则中。
a:link, a:visited, a:active, .menunav:hover {
color: white !important;
text-decoration: none !important;
}
.menunav:hover {
background: #333;
transition-duration: 0.5s;
}
关于css - 如何在 CSS 中继承类值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38647951/