CSS Selector :first-line

Description

The :first-line selector adds a style to the first line of the specified selector.

Example


<!DOCTYPE html>
<html>
<head>
<style>
p:first-line{<!-- ww  w . ja va2  s. c om-->
    background-color:red;
}
</style>
</head>

<body>
<p>This is a paragraph. This is a paragraph. This is a paragraph. 
This is a paragraph. This is a paragraph. This is a paragraph. 
This is a paragraph. This is a paragraph. This is a paragraph. 
This is a paragraph. This is a paragraph. This is a paragraph. </p>
</body>
</html>

Click to view the demo

The code above generates the following result.

:first-line




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference