Setting Line Height

Referred to in traditional typography as leading, line height is the space between each line in a section of text. CSS enables you to control this using the line-height property, with length, number, or percentage values (see Example 9-7).

Example 9-7. Adding line height to paragraphs with length, number, and percentage

<p style="line-height: 20px;">I married early, and was happy to find in my wife adisposition not uncongenial with my own. </p><p style="line-height: 2;">Observing my partiality for domestic pets, she lost no opportunity of procuring those of the most agreeable kind. We had birds, goldfish, a fine dog, rabbits, a small monkey, and a cat.</p><p style="line-height: 65%;">This latter was a remarkably large and beautiful ...

Get Spring Into HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.