💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## :after 选择器 ### 定义和用法 :after选择器向选定的元素之后插入内容。 :after是伪元素,并且它生成包含放置在元素中的内容之后的生成内容的伪元素。 使用[content](https://www.w3cschool.cn/cssref/pr-gen-content.html) 属性来指定要插入的内容。 默认情况下,此伪元素是内联的,但是可以使用属性显示更改。 **例子:** ~~~ a.external:after {content: " " url(image.gif);) p:after {content: " | ";} ~~~ ## 实例1--每个元素之后插入内容: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> p:after { content:"- 注意我"; } </style> </head> <body> <p>我的名字是 Donald</p> <p>我住在 Ducksburg</p> <p><b>注意:</b> :after在IE8中运行,必须声明!DOCTYPE </p> </body> </html> ``` ## 实例2--在每个 之后插入的内容和样式: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> p:after { content:"- Remember this"; background-color:yellow; color:red; font-weight:bold; } </style> </head> <body> <p>My name is Donald</p> <p>I live in Ducksburg</p> <p><b>注意:</b>:after作用于IE8 以及更早版本的浏览器,DOCTYPE 必须已经声明.</p> </body> </html> ```