• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

br command outdated in HTML

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have read somewhere in an article (but couldn't remember it exactly where) that the <br> command in HTML is getting outdated.
Can someone explain this

Thanks ...
 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't say that it is outdated, however it should be used where it makes sense, and not as a replacement for other tags, such as the paragraph tag and the unordered list tag.

I most often use the break tag inside the address tag, to place each line of an address on its own line.

If I wrote a poetry blog, I would probably use the paragraph tag for the stanza, with br tags to place each line on its own.

You will have to make your own judgment as to what makes sense where.
 
author
Posts: 85
5
PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<br> can be abused as one of those presentation tags, not as offensive as <font> but still a little. The modern thinking is that on the client-side (the browser) you have the three layers:
  • content - HTML/XHTML
  • presentation - CSS
  • behavior - javascript


  • Mixing the three layers is a bad practice, for example defining colors inside the HTML. The HTML should be only the content, like XML with no hints as to how it will be displayed. The content should be semantic, each tag describing the content, like <ul> and <ol> for lists and so on.

    If you need a new line, that's more often a new paragraph, so you should probably use a <p> tag. Now sometimes you need a new line that is not a paragraph, like when in Word you hit SHIFT+ENTER. That's fine, but having two <br>s one after the other smell like a paragraph. If you find yourself using several <br>s in sequence, that's a sign that maybe you should use CSS to achieve the desired presentation.

    I don't think there's anything wrong with the <br> tag per se, but it shouldn't be abused.

    I see that even in HTML 5 it won't be deprecated, because it has its semantic meaning - a line break.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!