:first-line and :first-letter

Explorer 6 Strict mode requires a space between the selector and the opening bracket {. This bug is solved in Explorer 7.

The pseudo-classes :first-line and first-letter are for giving special styles to the first line and letter of an HTML element.

The first line is determined by the browser as the real first line of the paragraph on the screen. So if you resize your browser window the first line will become longer or shorter. The styles will be applied to this longer or shorter first line.

Testsheet:

p:first-letter {text-decoration: underline;}
p:first-line {font-style: italic;}

Dynamic content

This is a test paragraph. You can insert extra text at its start; the :first-line and :first-letter styles should be updated to accomodate this new text. This works in all browsers, except that Safari creates one extra 'T' at the start of the paragraph.