HTML CSS examples for CSS Selector:first-line
The ::first-line selector selects the first line of the specified element.
The ::first-line selector can only be used with block-level elements.
The following properties can be used with ::first-line:?
Select and style the first line of every <p> element:
<!DOCTYPE html> <html> <head> <style> p::first-line {<!--from w w w .j av a 2 s . c om--> background-color: yellow; } </style> </head> <body> <h1>header</h1> <p>This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. .</p> </body> </html>