SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Validation error...

    <p class="title_box"><a href="docs/2011.pdf">Custom Packages</a><hr /></p>

    I'm getting an error saying: end tag for element "p" which is not open.

    I thought I was closing everything in this line correctly?

    ( <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> )

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,870
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    With an HTML 4.01 doctyoe it should be coded:

    <p class="title_box"><a href="docs/2011.pdf">Custom Packages</a><hr></p>

    The /> for self closing tags are only used in XHTML.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh ok, I thought it was something with the doc type, I'm new to this kind of stuff.

    Since I have a lot of self-closing tags in my website, perhaps I should switch to a different doc type?

    Suggestions?

  4. #4
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably like...

    XHTML 1.0 Strict?

    I want to stay up to date with current doctypes and HTML trends.

  5. #5
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Bades, in my opinion it's better to remove the self-closing tags and stick with HTML 4.01 Strict. Stephen, since the <hr> tag is a block element, shouldn't it be outside the <p></p> element?

  6. #6
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I decided that XMHTL 1.0 Strict would be best practice top use.

    Can't figure out this one though...

    Document type does not allow element "hr" here; missing one of "object", "ins", "del", "map", "button" start-tag

    …class="title_box"><a href="seminars.html">Training &amp; Seminars</a><hr /></p>

    So what am I suppose to do if I want to place an hr here?

  7. #7
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Black Max View Post
    Stephen, since the <hr> tag is a block element, shouldn't it be outside the <p></p> element?
    Ah you seemed to answered my last post then.

    I'll look into the differences of HTML4.01 and XHTML 1.0, and see which one is better or more widely accepted.

  8. #8
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,077
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Try moving the <hr /> so that it's outside of the </p>
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  9. #9
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    Try moving the <hr /> so that it's outside of the </p>
    Cool works!

  10. #10
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,870
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Black Max View Post
    Stephen, since the <hr> tag is a block element, shouldn't it be outside the <p></p> element?
    Oops - I spotted the most obvious error in the code and didn't think to check if it was the only one - or the one causing the error message.

    Also it has been qute a while since I added a <hr> tag into a page since they are impossible to style consistently across the different browsers so I hadn't needed to think about it being a block tag for quite a long time.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  11. #11
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Also it has been qute a while since I added a <hr> tag into a page since they are impossible to style consistently across the different browsers so I hadn't needed to think about it being a block tag for quite a long time.
    That's why the ONLY time I use HR is for the CSS off or print users to divide up areas -- and then set them to display:none for media="screen,projection,tv" and media="handheld"

    I want a divider after a paragraph like that, I pad the bottom, margin the bottom, and use border.

    That said, class="titleBox" ?!? Shouldn't that be a numbered heading? (wild guess, I'd have to see the whole section of markup)... as it is that's not enough text to warrant calling it a paragraph.

  12. #12
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    That said, class="titleBox" ?!? Shouldn't that be a numbered heading? (wild guess, I'd have to see the whole section of markup)... as it is that's not enough text to warrant calling it a paragraph.
    I've already used h1, h2, on the page, and I've used h3, on a few other pages(I'm using one CSS page)

    So I could use an h4, but I heard after h3, that headings aren't really so useful like for SEO stuff. is this true?

  13. #13
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,870
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Bades View Post
    I heard after h3, that headings aren't really so useful like for SEO stuff. is this true?
    If you are thinking about SEO when deciding what tags to use in the page then you are going about it entirely the wrong way.

    Use the tags that best describe what their content is. If you define the page with the semantically correct tags then both real people and search engines will be able to understand it better and less SEO will be required.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  14. #14
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Bades View Post
    I've already used h1, h2, on the page, and I've used h3, on a few other pages(I'm using one CSS page)

    So I could use an h4, but I heard after h3, that headings aren't really so useful like for SEO stuff. is this true?
    Felgall hit the bullet points -- in particular the "if you are using a tag JUST for SEO you're probably using it wrong" -- but your wording on "I've already used" makes me ask "are you using them correctly?"

    The POINT of heading tags is to say in each section what's a subsection of what -- H3 is the start of a subsection of the h2 preceeding it, H2 is the start of a subsection of the h1 preceeding it, and you should only ever have one h1.

    I'd have to see the whole page to say for sure, but so far your wording is sending up warning flags with me.

    But I get that way whenever I see things like <p class="title"> or <td class="heading"> -- it's usually an indication someone hasn't grasped how semantics work yet or have giant gaps in their understanding of HTML.

  15. #15
    SitePoint Addict
    Join Date
    Aug 2010
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    The POINT of heading tags is to say in each section what's a subsection of what -- H3 is the start of a subsection of the h2 preceeding it, H2 is the start of a subsection of the h1 preceeding it, and you should only ever have one h1.
    My h1's and h2's are formatted the same throughout the website on each webpage.

    I'm also only using one CSS page for the entire website, so when I establish style for the h1 on the home page, the h1 on the products page is going to be the same.

    Can you apply id's and classes to headings?

    Quote Originally Posted by deathshadow60 View Post
    But I get that way whenever I see things like <p class="title"> or <td class="heading"> -- it's usually an indication someone hasn't grasped how semantics work yet or have giant gaps in their understanding of HTML.
    This is completely true, I'm a beginner only been doing this for about 6 months, and everything new site, and every new page has something where I learn more and more about HTML/CSS.

    I would say it's almost impossible to learn everything there is about HTML before you start playing around with it, an dI'm learning as I go along.

    Also are you guys stating that any time you have a header/title of section of text or whatever it should most likely be within a <h> tag?

  16. #16
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Bades View Post
    Also are you guys stating that any time you have a header/title of section of text or whatever it should most likely be within a <h> tag?
    For the most part -- yes... either a numbered heading, or the appropriate heading-type tag for the element.

    Numbered headings are NOT the only heading type elements in HTML. You have CAPTION which is basically a heading for a table, you have TH which is a heading for a row or column (typically for the column if in THEAD, or for the row if in TBODY -- assuming you use those structural/semantic elements PROPERLY, which of course few people do). You have LEGEND which is the title for a FIELDSET, a grouping of form INPUTS, you have LABEL which is a heading for a form input element like INPUT, TEXTAREA, SELECT, etc.

    Oh, and about H1 -- since there should only one of these per page ANY other heading-type element you use on the page is basically saying it's a subsection of THAT... this is why IMHO it should be the first semantic element on the page since by definition EVERYTHING is a subsection of it... and so on and so forth down the list. You make a new heading, the content under that heading should be a subsection of the heading preceding it, with the headings fanning out like a tree.

    Basically we're talking semantic markup -- saying what things ARE and NOT how they are going to appear; which also entails NOT using tags with meanings around the wrong elements... two or three words of text is not a GRAMMATICAL paragraph, and if you are thinking a typographical paragraph you are thinking APPEARANCE, which has NO BUSINESS in your HTML. Just because it's text doesn't mean it gets a P around it... and if it's not text, it most certainly should not have a P around it. You see people make that mistake with IMG all the time... only time it would be appropriate to be around IMG would be if said image is inline to the text like a smily

  17. #17
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Stephen, there are some wonderfully Byzantine code snippets out there for styling HR elements so they display the same cross-browser. Generally, they're more trouble than they're worth, I think.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •