How to Link to the W3C CSS3 Validation Page

Automatic Method:

You should now simply use: http://jigsaw.w3.org/css-validator/check/referer?profile=css3.

Manual Method:

Typically, if we want to link dynamically to the W3C Valid CSS page, we use this link:

http://jigsaw.w3.org/css-validator/check/referer

That’s perfect if you’re using all CSS2.1, as that’s the default checker, but if you implement even one CSS3 style, you’ll fail validation. So, we can no longer use the referrer method until CSS3 becomes highly supported to the mainstream.

As a compromise, instead of linking our pages to the referrer link, we’ll have to link our stylesheet to the CSS3 Validator like so:

<a href="http://jigsaw.w3.org/css-validator/validator?uri=http://website.com/css/style.css&profile=css3">Valid CSS</a>

(remember to use &amp; in place of & so you don’t break HTML validation)

  • Nice information, I really appreciate the way you presented.Thanks for sharing..

  • You bet. Thanks

  • I thank you for this useful and complete post, I was looking for post like this. I like your blog.

  • Nice, I knew they would update it at some point. I’ll update the post, as this is definitely the best method now.

    But, no doubt my blog doesn’t validate ;). WordPress isn’t even valid out-of-the-box.

    Thanks for the update.

    Thanks, Bryan

  • Thanks a lot for this useful information! Nice blog too.

  • Sikor

    Thanks, you help me.

  • Thanks :)

  • jpogge

    This works well for me for checking xhtml and css. Change it to suit, but be careful with the double and single quotes.

    <?php
    // Construct a uri for xhtml and one for css
    $host = $_SERVER['HTTP_HOST'];
    $self = $_SERVER['PHP_SELF'];
    $xhtmluri = 'http://validator.w3.org/check?uri=&#039; . urlencode('http://&#039;) . urlencode($host) . urlencode($self);
    $cssuri = 'http://jigsaw.w3.org/css-validator/check/referer?profile=css3&uri=&#039; . urlencode('http://&#039;) . urlencode($host) . urlencode($self);

    // Use the uris constructed above in the following links to the validating services
    $xhtml = 'xhtml‘;
    $css = ‘css‘;

    echo $xhtml . ‘ | ‘ . $css;
    ?>

  • jpogge

    Somehow the initial <?php didn't make it into my post. Also, I wasn't expecting the bryanhadaway.com server to process the php code I submitted. Hopefully everyone can figure it out.

  • jpogge

    Second try omitting the php delimiters.

    // Construct a uri for xhtml and one for css
    $host = $_SERVER[‘HTTP_HOST’];
    $self = $_SERVER[‘PHP_SELF’];

    $xhtmluri = ‘http://validator.w3.org/check?uri=’ . urlencode(‘http://’) . urlencode($host) . urlencode($self);
    $cssuri = ‘http://jigsaw.w3.org/css-validator/check/referer?profile=css3&uri=’ . urlencode(‘http://’) . urlencode($host) . urlencode($self);

    // Use the uris constructed above in the following links to the validating services
    $xhtml = ‘xhtml‘;
    $css = ‘css‘;

    echo $xhtml . ‘ | ‘ . $css;