Forums

[resolved] WordPress and W3C validator. (9 posts)

  1. reece_wba
    Member
    Posted 2 years ago #

    Hi

    I have a WordPress blog, running 2.8.6 currently and when I try to validate the page http://webbusinessworkshops.com/web-success-club-sunday/ at http://validator.w3.org , I get 20 errors, such as:

    Line 91, Column 23: document type does not allow element "style" here

    <style type="text/css">

    I've played around with the page content and what I have noticed is, that it will validate only when I am using basic HTML tags such as:

    <h3>Heading blah blah</h3>
    <p>Paragraph abc</p>

    But once I start using style attribes, my WordPress blog produces pages that wont validate by W3C's online validator. I.e

    <h3 style="text-align: center; padding-left: 60px;">Heading blah blah</h3>
    <p style="text-align: left; padding-left: 60px;">Paragraph abc </p> ...

    Does WordPress only accept basic HTML tags?

    Does anyone have any suggestions or explanation for this behaviour?

    Thanks for any advice or help,

    Reece.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    The markup with inline style that you posted is completely valid. It might help if you posted a link to a real page that isn't valid. And no - WordPress can deal with inline style, markup, classes and ids.

  3. herbiehysteria
    Member
    Posted 2 years ago #

    i have about 10 validation errors and im adament it is my markup within my pages. is there no definitive guide about how to hand-code wordpress pages so they validate properly.

    i found the same problem, it seems there is a conflict between how WP interprets certain HTML tags. It tends to over-use the <p> tag.
    HH

  4. reece_wba
    Member
    Posted 2 years ago #

    Thanks for your replies!

    The page I linked to in my first post is a real page that doesn't validate.

    I'll post the code I've used for that page below if it helps.

    - Code moderated as per Forum Rules -

  5. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try posting a link to the page in question.

  6. s_ha_dum (was apljdi)
    Member
    Posted 2 years ago #

    is there no definitive guide about how to hand-code wordpress pages so they validate properly.

    WP doesn't have special mark-up rules for validation. The 'guide' would be the same guide as with any other site. What you have to understand is how the PHP works to generate the page so that you don't put elements somewhere where they are not allowed, for example. As esmi said, a link would help.

  7. Mark / t31os
    Moderator
    Posted 2 years ago #

    The opening post has a link to a page with the problem people..

    The style attribute error is because you have this inside the body..

    <style type="text/css">
    #WBWheadertext {visibility: hidden; }
    #WBWheader{background-image:url(http://www.webbusinessacademy.com/flash/webinar/jennie-armato-pl_03.gif); background-repeat:no-repeat; height:136px; margin:0; padding:0;}
    .imgpreview {
    text-align:center;
    background-image:url('http://webbusinessworkshops.com/wp-content/uploads/2010/02/TVScreen_sm2.jpg');
    background-repeat:no-repeat;
    background-position:top center;
    width: 308px;
    height: 220px;
    padding-top: 16px;
    }
    .title h1{
    text-align:center;
    color: #000;
    width: 770px;
    height: 80px;
    }
    </style>

    Style defintions should be in the head, not the body...

  8. reece_wba
    Member
    Posted 2 years ago #

    Thanks for the tips.

    Even after moving the style definitions out of the body I still get the following errors, which seem to be related to the flash objects I've embedded. I know browser support it and also know that the embed tag was never part of any standardized version of HTML. However, the last error I get is the table tag so that's probably my last problem to work out.

    W3C validation errors are listed at http://wordpress.pastebin.ca/1792173

    Thanks for the help so far!

    Reece.

  9. reece_wba
    Member
    Posted 2 years ago #

    Just a follow up.

    I've solved the issue to get WordPress pages valid to W3C standards. It appears that there was some weird formatting introduced by WordPress at it like the table tag was inside the h2 tags for some reason.

    Thanks for all your help.

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic