1. Computing

Discuss in my forum

Jennifer Kyrnin

Don't use BR for layout

By November 8, 2008

Follow me on:

We have had so many conversations here about using (or not using) tables for layout, that I had forgotten about another layout "tool" that many people like to use - the BR tag. While I wouldn't go as far as Janko who says that the br element sucks, but it is not a good choice for spacing out content. It's better to use padding or margins on your elements to get the spacing you need. It's more precise (every browser can display the br differently) and if you use flexible measures (like em or %) your spacing will flex with your page size.
November 8, 2008 at 12:16 pm
(1) dougwig says:

While inappropriate for generating vertical space, the crusty old BR element is still useful when headers and other text (usually created by marketing folks) has to wrap in a very specific way. It also comes in handy for coding emails, where support for margin is limited. To generate 30 pixels of vertical margin in an html email drop a BR element in an empty DIV with line-height set to 30 pixels (again this is just for email).

November 8, 2008 at 12:17 pm
(2) Alexander says:

I still use the BR for non-paragraph () new lines (just to brake the line)… I think there is no problem with that.

November 8, 2008 at 3:13 pm
(3) Jennifer Kyrnin says:

Yes, using the BR for line breaks is the appropriate use of it. That includes making a headline wrap in a specific place.

The exception to this is if you’re making the headline wrap in a specific place because of the font size or width of the space. If you use a BR in that situation, and then someone resizes the browser, the break could end up looking wrong.

November 10, 2008 at 12:45 am
(4) decibel.places says:

are useful, but could be coded in the css


Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.