I dont close my p tags

Discussion in 'HTML & Website Design' started by HiLoRoller, Oct 24, 2007.

  1. #1
    Is it bad, if I don't use:
    </p>
    Code (markup):
    Is it necessary?
     
    HiLoRoller, Oct 24, 2007 IP
  2. live-cms_com

    live-cms_com Notable Member

    Messages:
    3,128
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    205
    Digital Goods:
    1
    #2
    Yes, it's bad. Your code is not valid and could display incorrectly in some browsers.
     
    live-cms_com, Oct 24, 2007 IP
  3. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Yes it is bad.

    The code will display wrong in some browsers depending on where it is placed.

    Browsers don't show people the page that you see if you view source (assuming it's not valid), instead it generates code and displays that, and in doing so it would attempt to close all your tags for you, which all browsers do differently.
     
    twistedspikes, Oct 24, 2007 IP
  4. trigoon

    trigoon Peon

    Messages:
    171
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Think about it this way:

    If its there, its there for a reason. Programming languages don't have all these functions in it for them to be ignored :) If your too lazy to close them yourself or just forget I suggest using Dreamweaver where you can just type </ and it will automatically close any unclosed tags.
     
    trigoon, Oct 24, 2007 IP
  5. longhornfreak

    longhornfreak Well-Known Member

    Messages:
    2,067
    Likes Received:
    95
    Best Answers:
    0
    Trophy Points:
    140
    #5
    I am just going to assume you use <p> to start a new line, if that is the case, use <br />
     
    longhornfreak, Oct 24, 2007 IP
  6. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #6
    No, when <p> is not closed but another <p> is encountered most of the browser interprets the first one as closed, however it is a bad practice.
     
    it career, Oct 24, 2007 IP
  7. Pinoguin

    Pinoguin Peon

    Messages:
    848
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #7
    don't, the site will be a mess and it won't validate in w3c
     
    Pinoguin, Oct 24, 2007 IP
  8. Dlabs

    Dlabs Active Member

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #8
    It's laziness if you don't - you should always aim to write complaint xhtml code, at least transitional 1.0, ideally strict.
     
    Dlabs, Oct 25, 2007 IP
  9. HiLoRoller

    HiLoRoller Active Member

    Messages:
    471
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #9
    ok ok....I'm sold :)
     
    HiLoRoller, Oct 25, 2007 IP
  10. jgjg

    jgjg Peon

    Messages:
    595
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #10
    use <br> tags more often. I think p tags are overused - the only reason I could see using them is if they had some seo benefit which I'm not aware of
     
    jgjg, Oct 25, 2007 IP
  11. tomcairns

    tomcairns Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If you are writing text which should be in paragraphs, then for the love of god please use <p> tags and finish it with a </p>

    It's called semantics, the tags are there for that use, so why use a <br> tag when there is a perfectly logical tag to use???

    You can even specify padding on <p> tags, or individualize them with <p class="larger"> so there is no excuse not to use them when it is so blantently obvious!!!
     
    tomcairns, Oct 25, 2007 IP
  12. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #12
    For a start it's <br />

    The <p> tags main benifit is to people using screen readers (i.e. people who can't see well enough to read it themselves).

    Other than that it's just semantics, not that important.
     
    twistedspikes, Oct 25, 2007 IP
  13. tomcairns

    tomcairns Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Are we not in this to make the internet a better experience for everyone???

    Why take shortcuts when they save no time? Is it really that hard to code properly, effectively and semantically? It makes sense and takes us out of the 1990's web design era.
     
    tomcairns, Oct 25, 2007 IP
  14. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #14
    Yeah, but some people don't care enough to do that.

    You'll learn that soon.

    I code valid xhtml strict now, didn't about 6 months ago. But most people think that if it works then theres nothing wrong.
     
    twistedspikes, Oct 25, 2007 IP
  15. tomcairns

    tomcairns Guest

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Hence why we need to change peoples opinions, and not just say, yeah use a <br /> its not important! Maybe it's just me being picky, but I think we all need to raise the standard higher if we're going to produce a better web for everyone!
     
    tomcairns, Oct 25, 2007 IP
  16. clinton

    clinton Well-Known Member

    Messages:
    2,166
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    110
    #16
    In the future and even now xhtml has to be used for all your html so browsers will display it properly. New web standards are that all tags must be closed or the code is invalid. Go here(W3validator) to validate your code.
     
    clinton, Oct 25, 2007 IP
  17. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #17
    Wow, folks... Just... wow.

    In HTML 4 there is NOTHING that says you have to close the paragraph tag. So long as you are using a HTML doctype you don't have to close your <P> (though it can stop SOME CSS browser bugs from cropping up) - likewise for <br>

    </p> is only manditory in XHTML doctypes, as is the self closing structure <br /> - in fact, closing a BR that way is INVALID HTML (though most browsers ignore that because it interprets the / as an escape code)

    Bottom line

    HTML - you don't have to close <p>, and you don't close <br>

    XHTML - you MUST close <p> and you must shortcut close <br />
     
    deathshadow, Oct 25, 2007 IP
  18. rcpalace

    rcpalace Peon

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Well, basically some browsers see things differently; without closing your "p" tags depending on your browser it can paragraph everything. Nonetheless, it won't be valid.
    Kind Regards.
     
    rcpalace, Oct 25, 2007 IP
  19. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #19
    Isn't it just that <br/> is invalid cause it doesn't have a space? Or is that just it won't work in older browsers (IE<=5)? Sometimes forget which.

    I thought it was <br /> that was okay cause HTML will ignore the space then /. But maybe it's the browsers i'm getting confused with.
     
    twistedspikes, Oct 25, 2007 IP