Selecting Part of an Element

You can also select just the first letter or first line of an element and then apply formatting to that.

To select the first line of an element

1. Type element, where element is the selector for the element whose first line you’d like to format.

2. Type :first-line to select the entire first line of the element referenced in step 1.

Image There’s no telling which words will be affected by first-line until you view the page in the browser and see how the content flows. It’s not determined by what line the words are on in the HTML itself.

<article class="about">     <h1>Antoni Gaudí</h1>     <p>Many tourists are drawn to ...

Get HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.