1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

<br /> vs <br>

Discussion in 'HTML & Website Design' started by adamjthompson, May 30, 2006.

  1. #1
    Why do some people use <br /> instead of <br> ?

    ~Adam
     
    adamjthompson, May 30, 2006 IP
  2. Scott Botkins

    Scott Botkins Peon

    Messages:
    823
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    XHTML, it's the closing tag for <br>
     
    Scott Botkins, May 30, 2006 IP
  3. sc0ttish

    sc0ttish Peon

    Messages:
    183
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    dont know, i always tend to use <br/> but from time to time forget the /.

    Never really had any problems though.
     
    sc0ttish, May 30, 2006 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hmm I thought it was the replacement for <br>... So why is the slash after the br then? Confusing!
     
    T0PS3O, May 30, 2006 IP
  5. Scott Botkins

    Scott Botkins Peon

    Messages:
    823
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <br /> is only used in XHTML programming. For example

    HTML - Hello World <br> Bye

    XHTML - Hello World <br> Bye <br />

    It's just a closing tag.
     
    Scott Botkins, May 30, 2006 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    XHTML is html reformulated as xml. XML requires that all tags be closed. Some tags in html are empty, that is they are replaced by whatever they're tagging. For example the <img> is replaced by the actual image, <br> is replaced by a line-feed, and <hr> is replaced by a horizontal line. These tags have no closing tag in html.

    XML allows a short-hand for empty elements, the /> mechanism; thus, <br/>. That's good for xhtml, but invalid for html[1]. HTML does allow it, though, if there is a space before the virgule, /. So <br /> fulfills the xml requirement, while being html valid. Using something like <br></br> would be invalid, as the closing tag is prohibited, and <br><br /> is redundant in html and invalid in xhtml.

    cheers,

    gary

    [1] Since IE does not support xhtml, we are usually forced to serve our xhtml pages as text/html, thus the little hack.
     
    kk5st, May 30, 2006 IP
    Sev7en and (deleted member) like this.
  7. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Good explaination kk5st, as a rule I always (and should everyone I think) use <br /> for line breaks. It's a good habit to be in.
     
    mdvaldosta, May 30, 2006 IP
  8. thelouisvilleseo

    thelouisvilleseo Peon

    Messages:
    112
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    To anyone that doesn't understand <br> versus <br />

    <br /> is a self-closing tag. Just like <img src="" width="" height="" alt="" /> an image tag is self-closing meaning that it doesn't require an open/closing tag surrounding it's contents.

    I like coding in XHTML, does it matter at the moment? Hell no, but it works better in the fact that modifications are easier when following the rules/standards set by the W3C.

    Either code fully in XHTML or not at all. Either fully use CSS or not at all, simple as that.

    The above is my opinion, not stating facts. - Take it as you will.

    Read w3C's documentation... seriously, it will tell you good/bad things about the standards that are set.

    - Rob Docherty - www.interceptdesigns.net - www.thelouisvilleseo.com
     
    thelouisvilleseo, Jun 1, 2006 IP
  9. 907Group

    907Group Banned

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    xhtml.. got to get in to that.. first sat that </br><br> i swore he got that backwards.. nice answers.. learned something :)
     
    907Group, Jun 1, 2006 IP
  10. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    In summary:
    If you were writing in XHTML, you would write
    <br></br>
    ...OR...
    <br />
    If you are writing in HTML and want to prepare for XHTML, write:
    <br />
    This applies to all tags that in HTML don't need to be closed like
    <IMG> and <HR>. BTW, if you are the kind of foreseeing person,
    it is better to write all tags in lower-case as this is mandatory in
    XHTML.
     
    TechnoGeek, Jun 2, 2006 IP
  11. iletiler.com

    iletiler.com Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11

    right, it is not useful for html coding
     
    iletiler.com, Jun 3, 2006 IP
  12. Nick_Mayhem

    Nick_Mayhem Notable Member

    Messages:
    3,486
    Likes Received:
    338
    Best Answers:
    0
    Trophy Points:
    290
    #12
    HE EHEH. I use <br> only to save a stroke on my keyboard and may be till I am finished with this programming and webdesinging. I will save enough keystrokes that would make a new project. And maybe that project would also sell for some $$$'s
     
    Nick_Mayhem, Jun 3, 2006 IP
  13. mykoleary

    mykoleary Peon

    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Several people have said use <br><br/> OR use <br></br>

    WRONG!!! Read kk5st's post. It is correct.
     
    mykoleary, Jun 3, 2006 IP
    kk5st likes this.
  14. humm

    humm बहादुर बच्चा

    Messages:
    4,346
    Likes Received:
    850
    Best Answers:
    0
    Trophy Points:
    310
    #14
    in firefox and ie.. if you compare..

    <br> </br> - gives more space too.

    <br/> - give less spacing [- is xtml self closing tag]
     
    humm, Jun 3, 2006 IP
  15. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #15
    What part of "end tag: forbidden" don't you understand? At some point, one must RTFM.

    http://www.w3.org/TR/html4/struct/text.html#edef-BR

    gary
     
    kk5st, Jun 4, 2006 IP
  16. mykoleary

    mykoleary Peon

    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #16
    <shakes head />
     
    mykoleary, Jun 4, 2006 IP
  17. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I'll give the thumbs up for Scott Botkins answer. Simple, clean and efficient. Onya Scotty!
     
    Cheap SEO Services, Jun 4, 2006 IP
  18. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Well. Also, if you use the fixit tool in html kit it will close all your line breaks for you using the xhtml tag!
     
    Cheap SEO Services, Jun 4, 2006 IP
  19. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #19
    And, wrong. RTFM[1]

    gary

    [1] The construct <br></br> would be allowed if you were serving the xhtml document as xml, i.e. application/xhtml+xml or one of the other allowed but not prefered xml MIME types. The closing tag is specifically prohibited in html. If you don't serve it as html, IE can't render it.
     
    kk5st, Jun 4, 2006 IP
  20. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #20
    >><br /> is only used in XHTML programming. For example
    >>HTML - Hello World <br> Bye
    >>XHTML - Hello World <br> Bye <br />

    In XHTML, <br /> is a shorthand to not use <br></br>. It is used by
    itself and not as a closing tag.
     
    TechnoGeek, Jun 4, 2006 IP