Web速查-索引

Alt text

定义

:first-line 选择器用于选取指定选择器的首行。

注意:以下属性可与 :first-line 使用:字体属性、颜色属性、背景属性、word-spacing、letter-spacing、text-decoration、vertical-align、text-transform、line-height、clear

语法

tagName:first-child;

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>鱼C-零基础入门学习Web(Html5+Css3)</title>
<style>
p:first-line
{
background-color:green;
}
</style>
</head>
<body>
<h1>FishC.com</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. A, adipisci beatae ea earum, eius facere itaque natus neque nobis perferendis perspiciatis quae quas quasi repudiandae saepe! Commodi labore nesciunt possimus!</p>
</body>
</html>

FishC.com

Lorem ipsum dolor sit amet, consectetur adipisicing elit. A, adipisci beatae ea earum, eius facere itaque natus neque nobis perferendis perspiciatis quae quas quasi repudiandae saepe! Commodi labore nesciunt possimus!

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号

Safari Chrome FireFox IE
1.0 1.0 1.0 5.0