BR element sucks!
You know how it goes. Designer creates the design templates or whatever and then developers have their say. Sometimes, it happens that they mess up something. Among many design issues caused by developers, one in particular really drives me me nuts - incorrect usage of <br/> element. I often find that <br/> element is being used to create layout. And this is simply - incorrect.
Element <br/>, or line break element produces a forced line break (carriage-return) in text. So you use it in text. If you use <br/> element to make a space between other elements, e.g. input fields and buttons, you can mess up the design. If you separate input fields wit line breaks you make the designer's work harder if he/she wants to change the layout. Let's see the following example:

If you do things this way, you might make it impossible to restyle the layout. If, for example, designer wants to move Login button to the right of the password field, this won't be possible using simple CSS. Not to mention if HTML code is being generated on the server - even worse. Instead of this, you can easily get the same visual effect if you apply some CSS styles:

So, if you want to style web form, use CSS, use margins or padding. These things should be set through CSS. Period. Did you ever notice the same thing? How do you deal with this issue?
- Login or register to post comments
- 1210 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)










Comments
Schalk Neethling replied on Mon, 2008/11/10 - 12:28pm
Nice article Janko, I do however find that I use the br element to ensure that forms stay usable when CSS is disabled. So instead of the form elements running all in one line you can have some control:
For example:
rip747 replied on Mon, 2008/11/10 - 4:29pm
Dude they're designers, not coders like us.
"Did you ever notice the same thing? How do you deal with this issue?"
I learned to stop bitching and just correct their mistakes.
I'm tired of programmers and CSS nerds bashing someone else just because they don't do it "the proper way". There's more then one way to skin a cat. Live with it.
mcarthurgfx replied on Wed, 2008/12/24 - 7:40pm
in response to: Volume4