web design

Line spacing blocks of paragraphs in HTML with CSS

Suppose you have a note class in HTML. A note can have one or more paragraphs.

<p>This is not a note.</p>
<p class="note">This is the first line of a note.</p>
<p class="note">This is the second line of a note.</p>
<p>Back out of the note again.</p>

Here is a CSS snippet you can use if you want to add margins to separate the note from the surrounding text without affecting the line spacing of the note itself (and adds some sensible page breaking behaviour).

Syndicate content