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.

line break code?

Discussion in 'HTML & Website Design' started by ameerulislam10, Jan 25, 2011.

  1. #1
    Line break code

    <br>
    </br>
    <br />
    Code (markup):
    They all work to indicate the line break. But why there are 3 types of codes? What are the differences?
     
    ameerulislam10, Jan 25, 2011 IP
  2. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #2
    The proper way to define a line-break, according to html standards:
    <br />
    Code (markup):
    You'll notice the browser will still parse the tag, however any SINGLE html tag requires a /> to distinguish that fact. Another example is the img tag.
     
    BillyConnite, Jan 25, 2011 IP
  3. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #3
    You must be kidding, there is no </br> tag.

    In HTML the <br> tag has no end tag.
    In XHTML the <br> tag must be properly closed, like this: <br />.
     
    radiant_luv, Jan 25, 2011 IP
  4. ameerulislam10

    ameerulislam10 Peon

    Messages:
    461
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It exists or not (</br>) but it works. Try it your self.
     
    ameerulislam10, Jan 25, 2011 IP
  5. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #5
    It doesn't on modern browser.

    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>blah blah</title>
    </head>
    <body>
    
    &lt;br&gt;
    <p>Lorem ipsum dolor sit<br> amet, consectetur adipiscing elit.</p>
    
    
    &lt;br/&gt;
    <p>Lorem ipsum dolor sit<br/> amet, consectetur adipiscing elit.</p>
    
    &lt;/br&gt;
    <p>Lorem ipsum dolor sit</br> amet, consectetur adipiscing elit.</p>
    
    
    </body>
    </html>
    
    
    Code (markup):
     
    radiant_luv, Jan 25, 2011 IP
  6. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #6
    </br>
    Code (markup):
    Sure works with FF 3.6

    It's not true xhtml, but it shows up. You might have to remove your doctype...

    But that's not the issue here, most webpages are not w3 verifiable, yet they show up fine. Anyway we're discussing the right way to display a line break, not whether or not it will work... and it's been covered.
    <br />
    Code (markup):
     
    BillyConnite, Jan 25, 2011 IP
  7. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #7
    The html document should have a doctype. reason 1. otherwise browser process the document in Quirks Mode. reason 2. You will not be able to use a HTML (HyperText Markup Language) Validator to check the page coding. HTML validation requires the DOCTYPE declaration.
     
    radiant_luv, Jan 25, 2011 IP
  8. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #8
    Absolutely radiant...

    But again, why are we talking about this now? It's been covered... I was simply telling you how to get a browser to parse an invalid <br /> (</br>).

    He has his answer.
     
    BillyConnite, Jan 25, 2011 IP
  9. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #9
    1. To make sure to inform that removing doctype is not a good practice.
    2. I really missed the second part of your post "But that's ......
    I think I need a break .:eek:
     
    radiant_luv, Jan 25, 2011 IP
  10. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #10
    ditto.

    Lets call it quits before we hate each other lol ;)
     
    BillyConnite, Jan 25, 2011 IP
  11. ukescuba

    ukescuba Peon

    Messages:
    91
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    many of the browsers are very forgiving ive seen some terrible code in the past and wondered how it was possible to display - typically when there is a lot of errors you will see issues when viewing the sites in different browsers particularly mobile sites

    stick with <br /> :)
     
    ukescuba, Jan 25, 2011 IP
  12. rswebs

    rswebs Peon

    Messages:
    23
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    so you wont have problems with some browsers just use <br />
     
    rswebs, Jan 25, 2011 IP
  13. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #13
    LOL

    Yeah yeah, those kiddies again. Telling "you can remove DOCTYPE"...

    Okay, then why don't you use Word to "program" your website?

    Fact is, removing DOCTYPE = BAD

    (A lot of "php coders" suck in HTML/CSS, I know ;) )
     
    CSM, Jan 25, 2011 IP
    sarahk likes this.
  14. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #14
    <br /> is fine.
    It pays to read an entire thread sometimes...

    Again, i was telling him how to reproduce an error, not suggesting you should not use a doctype. We are quite aware a doctype is necessary.

    -RC
     
    BillyConnite, Jan 25, 2011 IP
  15. Bullsaj

    Bullsaj Member

    Messages:
    142
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    30
    #15
    Line Break Code:

    HTML <br>
     
    Bullsaj, Jan 25, 2011 IP
  16. ameerulislam10

    ameerulislam10 Peon

    Messages:
    461
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Why does false (not true as you said) codes works at times? Why </br> acts as <br /> ? are the browsers have auto correction feature or something?
     
    Last edited: Jan 26, 2011
    ameerulislam10, Jan 26, 2011 IP
  17. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #17
    Absolutely.

    The doctype will also tell the browser how to parse different tags, or in different ways.
     
    BillyConnite, Jan 26, 2011 IP
  18. calvin4u

    calvin4u Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    The "br" tag inserts a single line break into the web document.
     
    calvin4u, Jan 27, 2011 IP
  19. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #19
    @ john smith1

    1 + 1 = 2
    2 + 2 = 4

    Thankyou for your meaningful post that has cleared up what we have been wondering... i love some good SPAM on toast.
     
    BillyConnite, Jan 27, 2011 IP
  20. sitearena

    sitearena Peon

    Messages:
    229
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Do not confuse anymore and use <br /> which is the standard accepted on all browsers.
     
    sitearena, Jan 27, 2011 IP