1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

what is the difference between <br> and <br /> tag

Discussion in 'Programming & Webmastering' started by rakkhi, Jan 24, 2011.

  1. rakkhi

    rakkhi New Member

    Jan 24, 2011
    4 (0.00/day)
    Thanks Received:
    Can any one tell me what is the difference between <br> and <br /> tag.
  2. scooper22

    scooper22 New Member

    Jan 12, 2011
    108 (0.04/day)
    Thanks Received:
    Central Europe
    The first is a tag from HTML, the second is from XHTML (the shorttag version of "<br></br>")
    Read up here: http://www.w3schools.com/XHTML/xhtml_html.asp

    Also is is very important to set your document's DOCTYPE to the language you're using, HTML is not the same as XHTML, HTML3 not the same as HTML4, "HTML 4.01 Transitonal" not the same as "HTML 4.01 Strict" and so on! Otherwise you'll get "guesswork" from the browser! This is very important!
    More here: http://www.w3schools.com/tags/tag_doctype.asp

    Use this validator to see if you made errors in your page (browsers should actually reject these with a "syntax error"): http://validator.w3.org/
    Last edited: Jan 24, 2011
    scaminatrix says thanks.
  3. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Oct 13, 2008
    20,850 (6.26/day)
    Thanks Received:
    IA, USA
    <br> is HTML 4.01 is Loose and Transitional compliant.
    <br /> is HTML 4.01 Loose, Transitional, and Strict compliant.

    The reason for the ending slash is because in XML, all tags must be closed. <br> is considered an opening tag and so is <img>. <br /> and <img /> tells parsers there is no ending tag. An XML interpreter would see <br> and look for a </br> which doesn't exist in the markup.

    <br /> is considered "proper."
    Last edited: Jan 24, 2011
    DannibusX says thanks.
    Crunching for Team TPU

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)