我想将hover CSS写入子元素,但是当父元素悬停时。所以像这样:
CSS中我想要的输出:
.parent {
background:#f8f8f8;
}
.parent .child {
color:#000;
}
.parent:hover child {
backgruond:#000;
color:#fff;
}
什么是#39; m在SCSS中使用:
.parent {
background:#f8f8f8;
.child {
color:#000;
//now I want to write css here for parent:hover. how can I do this?
}
}
答案 0 :(得分:3)
目前尚不清楚你的目的是什么,但我认为就是这个
<强> SASS 强>
.parent {
background:#f8f8f8;
.child {
color:#000;
//now I want to write css here for parent:hover. how can I do this?
}
&:hover {
background:blue;
.child {
color:green;
}
}
}
<强> CSS 强>
.parent {
background: #f8f8f8;
}
.parent .child {
color: #000;
}
.parent:hover {
background: blue;
}
.parent:hover .child {
color: green;
}
使用SASSMeister.com作为测试工具