<br>

Discussion in 'HTML & Website Design' started by oo7ml, Sep 12, 2007.

  1. #1
    whats the difference between the following

    1. <br />

    and

    2. <br>
     
    oo7ml, Sep 12, 2007 IP
  2. Cheap SEO Services

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

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's a line break tag.

    <br> is the break and </br> is the end of the break. However, there is no need for th </br>

    Col :)
     
    Cheap SEO Services, Sep 12, 2007 IP
  3. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    Yeah i know hat it is but, why do some people use <br />
     
    oo7ml, Sep 12, 2007 IP
  4. Overseas

    Overseas Well-Known Member

    Messages:
    1,098
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    140
    #4
    Overseas, Sep 12, 2007 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The reason people use <br /> is because they are writing semantically (precisely) for XHTML (and maybe HTML4.01 strict too I think).

    In ye bad old days, people used <br>. <br> is one of the so-called "empty" tags, like meta and img. They never had a closing tag and still don't. That is, there IS NO <img>blah.gif</img> <---- no no

    But even though they're empty, XHTML and HTML4.01 strict require that there's something saying where the end of the tag is. Thus, />. Some browser or somebody has a problem with just <br/> so a space is put in there to "fill" it: <br />

    NEVER use <br> <br /> because empty tags do not come in twos. Ever. But you'll see it now and then.

    So also for meta you'll see <meta blah blah stuff /> and <img src="wherever" alt="" />
     
    Stomme poes, Sep 12, 2007 IP
    webrickco likes this.
  6. vonvhen

    vonvhen Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you are using XML on your site, then <br> will give an error.

    <br /> is the correct way of writing a line break.

    Most browsers will recognize both.
     
    vonvhen, Sep 12, 2007 IP
  7. webrickco

    webrickco Active Member

    Messages:
    268
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Thx for the explanation, Stomme poes, i was about to post about the same question.
     
    webrickco, Sep 12, 2007 IP
  8. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #8
    What people told me was that from now on you should use <br />. The <br> is old school.
     
    Emperor, Sep 12, 2007 IP
  9. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Most modern browsers understand <br>. Although I heard netscape kicks up a fuss. So always use <br /> for better practice :)
     
    Noddegamra, Sep 12, 2007 IP
  10. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Let us clear up some misconceptions: the line break element <br> is specified in the W3C HTML 4.01 recommendation (with all Doctypes) and renders correctly in all Browsers. More importantly, it is specified in ISO-HTML which is the standard iteration of HTML (the W3c can only publish recommendations). See my ISO-HTML page for a thorough explanation. I have employed <br> for line breaks there as an exemplar of its use. I have also replicated my HTML 4.01 Strict Home page in ISO-HTML -- you can see the Validation result output here (scroll down for Markup). It is wrong to think of <br /> as somehow superior or more correct than <br> -- it is simply the well-formedness syntax employed in XML documents.

    XHTML has its own monumental usage problems -- for instance, practically all XHTML Web pages are being served as HTML without XML functionality -- I will be glad to illustrate that here if there is enough interest.

    James
     
    jamesicus, Sep 12, 2007 IP
  11. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Essentially, <br> = HTML, <br /> = XHTML

    The reason there is a space is because old Netscape browsers did not render <br/> correctly.
     
    Gordaen, Sep 12, 2007 IP
  12. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #12
    No that is not the reason -- Netscape Browsers had no problem rendering <br>.
    The answer is found in Appendix C.2. of the W3C Recommendation for XHTML 1.0 (2nd edition) - Empty Elements (paraphrasing): a space must be included before the trailing / and > of empty elements such as <br /> and <hr />, etc. ..........
     
    jamesicus, Sep 12, 2007 IP
  13. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #13
    You are incorrect. <br/> had problems in a previous Netscape browser as I said. As XHTML, it can be written that way, however the W3C Recommendations for HTML Compatibility Guidelines recommend using a space before the trailing slash on all empty tags. See their site for more info. If you notice, that's the appendix you referenced, so you must not have read the appendix title. For the declaration of how to create a proper empty tag, you should have looked at 4.6 of the guide.
     
    Gordaen, Sep 12, 2007 IP
  14. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I didn't say that -- I said that Netscape Browsers did not have any problem rendering <br>.

    That is what I pointed out. Actually the header for Appendix C indicates that it summarizes guidelines for authors who wish their XHTML documents to render in existing HTML user agents -- which all extant graphical Browsers are (not necessarily how they are served).

    In XML, empty elements can be terminated using either, for example, <br/> or <br /> ref: http://www.stylusstudio.com/w3c/xml11/sec-starttags.htm
     
    jamesicus, Sep 12, 2007 IP
  15. thewall

    thewall Guest

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    The tag <br> is part of the group of html tags that doesn't need been closed. However, the tag <br/> is recognized by the browser and it indicate that the BR tag is open and close in-self. Another example of this kind of tags is <img /> tag.
     
    thewall, Sep 12, 2007 IP
  16. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #16
    You quoted me as having said, "The reason there is a space is because old Netscape browsers did not render <br/> correctly." and then directly after that you said, "No that is not the reason -- Netscape Browsers had no problem rendering <br>." I made the assumption that you had a typo. Apparently that was incorrect and you were really just saying I was wrong and following with an argument unrelated to what I had said.

    You say actually as if I implied something else was meant by the heading of Appendix C (but good work with the copy/paste). My original post (the one you said was wrong) said that <br /> is used because <br/> is XHTML but an old version of Netscape had rendering problems with that. My post was correct, and that's why you see that specific section in Appendix C.
     
    Gordaen, Sep 12, 2007 IP
  17. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Sorry, Gordean, no offense intended. I seem to have misread your posts and badly garbled my responses (old age creeping in I am afraid). You are correct.

    Let me see if I can redeem myself -- please see my XHTML 1.0 Problems thread.

    James
     
    jamesicus, Sep 12, 2007 IP