CSS ::first-line 伪元素
示例
选择并设置每个 <p> 元素的首行样式
p::first-line {
font-size: 20px;
text-decoration: underline;
background-color: lightgreen;
}
自己动手试一试 »
定义和用法
::first-line
伪元素用于设置块级元素的首页面的样式。
注意: ::first-line 可以使用以下属性:
- 所有字体属性
- 所有背景属性
- color
- text-shadow
- word-spacing
- letter-spacing
- text-transform
- text-decoration
- text-decoration-color
- text-decoration-line
- text-decoration-style
- vertical-align
- line-height
版本 | CSS1 |
---|
浏览器支持
表中数字表示首次完全支持此伪元素的浏览器版本。
伪元素 | |||||
---|---|---|---|---|---|
::first-line | 1.0 | 9.0 | 1.0 | 1.0 | 7.0 |
CSS 语法
相关页面
CSS 教程:CSS 伪元素