Controlling line breaks

If you’ve ever used <br>'s to force blocks of text to wrap ‘perfectly’, you’ll probably know that this screws up in fluid layouts:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Duis augue metus, pellentesque sed molestie non, porta eget odio.

So the other day I was wondering:

If you apply display: none to a <br>, does it remove the line break?

Yeah it does!

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Duis augue metus, pellentesque sed molestie non, porta eget odio.

Combining this with Media Queries, it’s possible to remove all the <br>'s before the text starts to wrap. Best of both worlds! :)

GitHub Comments

    Loading...
add comment via GitHub