gpt4 book ai didi

css - 添加一个ID到:before Pseudo Class

转载 作者:行者123 更新时间:2023-11-28 10:04:47 29 4
gpt4 key购买 nike

是否可以在 :before 伪类的内容中添加类或 ID?我知道这行不通,但是类似:

#menu {
height: 100px;
width: 100px;
}
#menu:before {
class: "just-before-menu";
}
.just-before-menu {
background: green;
height: 100px;
width: 100px;
}

最佳答案

The :before selector inserts content before the content of the selected element(s).

Use the content property to specify the content to insert.

#menu:before {
content: '';
background: green;
height: 100px;
width: 100px;
}

http://www.w3schools.com/cssref/sel_before.asp

关于css - 添加一个ID到:before Pseudo Class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14610803/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com