使用css在元素的前面或者后面添加内容

:before 在元素前面添加内容

:after 在元素的后面添加内容

<!DOCTYPE html>
<html>
<style>
h1:after {
  content: '前面的内容';
}
h1:before{
content:'后面的内容';
}
</style>
<body>

<h1>***h1内容****</h1>

</body>
</html>

 

posted @ 2023-04-14 12:33  芬-mi  阅读(476)  评论(0)    收藏  举报