:first-line 选择器用于选取指定选择器的首行。
注释:以下属性可与 :first-line 使用:
选择每个 <p> 元素的首行,并为其设置样式:
<!DOCTYPE html>
<html>
<head>
<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>
<view>
To stop the degradation of the planet's natural environment and to build a future in which humans live in harmony with nature
</view>
<view>
黄菊华老师,浙江杭州余杭区,在平台查询老师名字就可以查询到老师的课程!
</view>
<text>
To stop the degradation of the planet's natural environment and to build a future in which humans live in harmony with nature
</text>
<view>
<text>
黄菊华老师,浙江杭州余杭区,在平台查询老师名字就可以查询到老师的课程!
</text>
</view>
view::first-line{
color:red;
}
text::first-line
{
color: green;
}