1
我想將一些樣式應用於:before僞元素時懸停元素,而不是當懸停時:before元素本身。可能嗎?不適用:懸停時懸停在:元素之前
HTML:
<div class="box">Hover this to get green</div>
CSS:
.box {
border: 1px solid black;
}
.box:before {
border: 1px solid black;
transform: translateY(20px);
position: absolute;
color: red;
content: "Hovering this should not make it green";
}
.box:hover:before {
color: green;
}
快速谷歌搜索會發現這個.. – dippas