SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <h1> tag probelm

    I'm trying to fix the w3 problems on my site. One of the reoccuring problems is this:

    document type does not allow element "h1" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.

    <span class="story-title"><h1><a href="http://www.

    My website is slashfilm.com, and every news article on the site must have an <h1> tag around it's headline. What can I add to fix this w3 issue?

  2. #2
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure you want H1s around every news article? Wouldn't an H2 be more appropriate. Typically you have one H1 for the header of the page, and H2s for the main titles like you news article.

    Your problem I assume is due to you putting the H1 inside a SPAN. Remove the span and apply the class="story-title" to the H1 directly instead. SPANs AFAIK are used for applying styles to inline content, not block level content such as H1s hence the error - or atleast I assume that's the problem.

    EDIT: One more thing, I'm no expert on SEO, but I suspect placing H1s round a bunch of things on your page will cause Google etc. to treat them as H2s anyway because there are so many of them. You're effectively diluting the effect of having a header by having so many of them.

  3. #3
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Hopefully you only have one H1 per page as it should be used to indicate the topics of the page. If you feel you need two then you should have two pages. And based on your post I think you're okay.

    Simply don't wrap your H1 tag in a span tag. Give it its own class or maybe even use <h1 class="story-title"> if you can.

  4. #4
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was going to post another comment about your code, but it instead prompted me to post this new topic instead:
    http://www.sitepoint.com/forums/show...37#post3229937

    It's something which you have a lot of in your code.

  5. #5
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so taking the span off fixed the problem, but adding <h2>'s is now causing more problems. My weblog software geeklog, only has one template for the blog posts. So I can only use either <h1> or <h2> for the story headlines. But on the index page it will group 15 news bogs in a row (ie 15 <h1> tags). So what should I do? What would be better?

    15 <h1 tags> on the main page so that my article page will have a <h1>header or 15 <h2> tags on the main page but my single blog posts will have an h2 tag for its headline?

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As has already stated, you cannot have a block level (in this case H1) element inside an inline one (in this case, SPAN). So by removing the SPAN you will be able to fix your validation problem.

    Second, headings are to be used to denote the sections of a page. As John (stymiee) stated, H1 is to be used for the page title (though I often use it as the site title - I'm weird like that) and should only be used once per page. H2-H6 should be used as headings for the various sections of your document.

    I'd take a look at your site right now but I (literally) have 71 other tabs open in Opera, so I'm going to have to clear them out first before I can look at your site and tell you what else you need to fix (and from what I've read previously in this thread, it sounds like you have a lot of fixing to do).

  7. #7
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dan, the span problem has been fixed. I've gone from 360 errors to 20... so i'm doing pretty good. But my big dilema is what to do with the <h1><h2> situation. As I explained, my site is a log, so on the main page 15 posts are displayed. My weblog software isn't the greatest, but I don't have time to hack it or change over right now. The template for the blog story is the same for the front page stories and the single page stories. What this means is that for the single page stories If I give the headline an <h1> like it should have, the front page is filled with 15 <h1> tags. If I give them an <h2> tag, on my single pages (which is where i get the most hits) the headline will be <H2>'d.

    So what should I do?

  8. #8
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Ok, that's just not right. Your site took 2 minutes, 15 seconds to load on my dialup connection. Frankly, I think the site needs to be re-built from the ground up, but that's for another thread.

    Ok, as for your question, here's what I'd do.

    Use the H1 element to describe what the page is about. This will go at the top of your document (note: for the purposes of this post, the word document will refer to everything between the <body> and </body> tags). Then in each major section of your site (your sidebars, and main content area, for example), use a H2 to describe and mark up those sections. Then, inside your main content area, where you have your articles, use a H3 for your article titles.

    You'll still have a lot to do, but at least it would be a start.

  9. #9
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think you understand my situation, read my last post again...

  10. #10
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not scrap the template and just edit the code by hand? It's not that much harder to edit some text than use a fancy blog tool. Otherwise it looks like you have no option but to do things incorrectly here.

  11. #11
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's too late in the game for me to just drop this program. We are looking to cross over to wordpress which would fix all the problems we're having, but for now I'm looking at which is the best of the two options presented above.


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
  •