How to preserve line breaks in p elements with CSS

pre-line Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks

Source: CSS white-space property

Example:

p.intro {
white-space: pre-line;
}

Works in all modern browsers and IE8+

Leave a Reply

Your email address will not be published. Required fields are marked *