Over a million developers have joined DZone.

BR element sucks!

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

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?

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.


Published at DZone with permission of Janko Jovanovic. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}