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. easyresume

    easyresume Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Others include <img="" />, <br />, <hr /> and <input ="" />

    I think it stemmed from Netscape incompatibilities.
     
    easyresume, Jun 5, 2006 IP
  2. BigGuy

    BigGuy Member

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #22
    Actually Scott it is either <br> or <br />
    The XHTML above is equivalent to:
    XHTML - Hello World <br> Bye <br>
    or
    XHTML - Hello World <br /> Bye <br />

    As another poster explained all tags in XHTML (like XML) must close. If it is a unary tag (e.g. img, hr, or link) you add the slash at the end so the browser (if it really cares that it is proper XHTML or XML) will know not to expect a closing tag.

    Also note </br> is not the same as <br />. </br> is a closing tag while <br /> is a self-closing tag. "<br></br>" is valid for XML but might be invalid for XHTML but definately redundant since it is sytntactly equivalent to "<br />"

    I don't know if this helps clear things up but explaining things another way sometimes helps.
     
    BigGuy, Jun 7, 2006 IP
  3. php4ever

    php4ever Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Hey is it too late to bring this up again?

    I just want a little confirmation here so I don't end up making a broad assumption.

    I fully understand DOC Types and I fully understand that XHTML is XML rendered as HTML but what I want to know is this;

    ARE THESE XHTML Compliant or not? Its my belief they are not.

    <br>
    <b><b/>
    <i></i>


    Oh and before you nail me for not reading the above posts, I in fact did, but found just a few points people made less than convincing while the one from Gary the most convincing.
    ~ J
     
    php4ever, Aug 17, 2007 IP
  4. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #24
    XHTML Compliant?

    99% of "xhtml" pages are sent as text/html so they really *are* HTML and it doesn't matter if you use <br /> or <br> because the browser is lenient.

    If you're talking about w3 validation, if you're using XHTML Transitional I do believe you can freely use <b> and <i>, but will probably get an error saying you need to close the <br>, with a / so it would be <br />. If you're using XHTML Strict then I do believe you will get an error since these were deprecated in XHTML Strict (B, I and other elements).
     
    soulscratch, Aug 17, 2007 IP
  5. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #25
    <br> is invalid, <b></b> and <i></i> are deprecated (but may be re-introduced soon with a more defined semantic meaning).

    Use <br />, <strong></strong> and <em></em>
     
    krt, Aug 17, 2007 IP
  6. php4ever

    php4ever Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #26
    Thank you for just verifying what I knew. Now I can boldly write in my blog on a subject I've been holding off on so I don't look ignorant for suggesting that the correct method of XHTML Strict is to use <br />, <strong></strong> and <em></em>
     
    php4ever, Aug 29, 2007 IP
  7. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #27
    I'm sure it was tested and <br /> loaded faster than the same page with <br> instead.
     
    twistedspikes, Aug 29, 2007 IP
  8. Jag100

    Jag100 Peon

    Messages:
    142
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #28
    Iv always used xhtml <br />. It just seems much easier that it has a closing tag with it.
     
    Jag100, Aug 30, 2007 IP
  9. jon2k6

    jon2k6 Guest

    Messages:
    602
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #29
    Already been explained pretty well. I used to use <br> alone. Now I use <br /> for line breaks, self closing as mentioned. I think you should use that if any.
     
    jon2k6, Feb 14, 2008 IP
  10. almondj

    almondj Peon

    Messages:
    768
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #30
    I've seen <br /> in PHP, specifically PHPbb.
     
    almondj, Feb 14, 2008 IP
  11. Sporsho

    Sporsho Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #31
    XHTML requires closing tags. So <br /> is used.
     
    Sporsho, Feb 15, 2008 IP