多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## :first-line 伪元素 ### 定义和用法 :first-line选择器用来指定选择器第一行的样式。 :first-line是伪元素,它生成包含元素的第一个格式化行的伪元素。 :first-line样式表示元素中的第一行文本,无论该行中可能出现多少个词。 :first-line只能附加到块级元素。可以应用到首字母的属性是有限的。 **例子:** ~~~ p.lead:first-line {font-weight: bold;} ~~~ **注意:** :first-line选择器可以使用以下属性:  * font properties * color properties  * background properties * word-spacing * letter-spacing * text-decoration * vertical-align * text-transform * line-height * clear **注意:** "first-line" 选择器适用于块级元素中。 ## 实例--每个元素的第一行选择的样式: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> p:first-line { background-color:yellow; } </style> </head> <body> <h1>WWF's Mission Statement</h1> <p>To stop the degradation of the planet's natural environment and to build a future in which humans live in harmony with nature, by; conserving the world's biological diversity, ensuring that the use of renewable natural resources is sustainable, and promoting the reduction of pollution and wasteful consumption.</p> </body> </html> ```