返回到:CSS 伪元素 | CSS教程
定义和用法
:first-line选择器用来指定选择器第一行的样式。
注意::first-line选择器可以使用以下属性:
- font properties
- color properties
- background properties
- word-spacing
- letter-spacing
- text-decoration
- vertical-align
- text-transform
- line-height
- clear
注意: “first-line” 选择器适用于块级元素中。
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
| 选择器 | 谷歌 | IE | 火狐 | 苹果 | opera |
|---|---|---|---|---|---|
| ::first-line | 1.0 | 9.0 部分从5.5 | 1.0 | 1.0 | 7.0 部分从3.5 |
实例
每个<p>元素的第一行选择的样式:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程网(web176.com)</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>作者:terry,如若转载,请注明出处:https://www.web176.com/cssprop/5319.html
支付宝
微信