要搭配::after和::before
#id1::before{
content:"haha";//文本
content:url('https://www.baidu.com.hah.png');//图片
content:attr(color)://元素属性
}
参考:https://segmentfault.com/a/1190000018143558
CSS::before和::after用法详解
本文详细介绍了CSS的伪元素`::before`和`::after`的使用,包括如何插入文本、图片以及元素属性。示例代码展示了如何设置`content`属性,以在元素前后添加内容。参考链接提供了更多相关知识。
要搭配::after和::before
#id1::before{
content:"haha";//文本
content:url('https://www.baidu.com.hah.png');//图片
content:attr(color)://元素属性
}
参考:https://segmentfault.com/a/1190000018143558
900

被折叠的 条评论
为什么被折叠?