These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:20 pm Advanced search

use of <style> within <head> invalidates page?

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

use of <style> within <head> invalidates page?

Postby Darren » Wed Nov 04, 2009 10:38 pm

As you can see here...

http://www.darrenhoyt.com/demo/wordpres ... heme=Gravy

...this WordPress theme has a widget activated which injects an additional block of <style> stuff within the <head>, invalidating the page -

http://validator.w3.org/check?verbose=1 ... %2Fblog%2F

It seems to be requiring the "scoped" attribute which I have no control over, short of editing the core WordPress files. Any way around this? A lot of plugins also inject styles in the <head> dynamically.
Darren
<h6>
 
Posts: 6
Joined: Wed Nov 04, 2009 12:52 am

Postby zcorpan » Thu Nov 05, 2009 12:21 pm

Your <style> block is in the <body>. If you move it to the <head> it should validate.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Darren » Thu Nov 05, 2009 6:32 pm

The style block I'm referring to is this...

<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

...and it's inside the <head>
Darren
<h6>
 
Posts: 6
Joined: Wed Nov 04, 2009 12:52 am

You should use the HTML 5 validator

Postby ryszard » Fri Nov 06, 2009 11:41 am

If you use the (experimental) HTML 5 WC3 validator instead of the standard one your page validates.

http://qa-dev.w3.org/wmvs/HEAD/
ryszard
<h6>
 
Posts: 4
Joined: Fri Nov 06, 2009 11:14 am

W3C not WC3!

Postby ryszard » Fri Nov 06, 2009 11:42 am

:D
ryszard
<h6>
 
Posts: 4
Joined: Fri Nov 06, 2009 11:14 am

Postby zcorpan » Fri Nov 06, 2009 1:51 pm

Aha.

I think what happens is that

http://www.darrenhoyt.com/demo/wordpres ... heme=Gravy

redirects to

http://www.darrenhoyt.com/demo/wordpress/

If I validate the second URL directly then the validator gets a different theme which uses <style> in body.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Darren » Fri Nov 06, 2009 5:12 pm

The 'index.php?wptheme=Gravy' bit in the URL just sets the cookie so you're viewing the right theme. But the result in either theme is the same:

Code: Select all
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.darrenhoyt.com/demo/wordpress/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.darrenhoyt.com/demo/wordpress/wp-includes/wlwmanifest.xml" />
<link rel='index' title='Theme TestDrive' href='http://www.darrenhoyt.com/demo/wordpress' />
<meta name="generator" content="WordPress 2.8.5" />
<link rel="stylesheet" type="text/css" href="http://www.darrenhoyt.com/demo/wordpress/wp-content/plugins/thickbox/thickbox.php?thickbox_action=tcss&amp;url=http%3A%2F%2Fwww.darrenhoyt.com%2Fdemo%2Fwordpress%2Fwp-content%2Fplugins%2Fthickbox%2Fthickbox%2Fimages%2F&amp;variant=default" />   <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

</head>


The part I'm referring to is at the end, right before the </head>, the class 'recentcomments'. That's the block of style that's not validating. Are you not seeing that when you view source code?
Darren
<h6>
 
Posts: 6
Joined: Wed Nov 04, 2009 12:52 am

Re: You should use the HTML 5 validator

Postby Darren » Fri Nov 06, 2009 8:32 pm

ryszard wrote:If you use the (experimental) HTML 5 WC3 validator instead of the standard one your page validates.

http://qa-dev.w3.org/wmvs/HEAD/


Thanks ryzard, I didn't know that existed.
Darren
<h6>
 
Posts: 6
Joined: Wed Nov 04, 2009 12:52 am

Postby zcorpan » Sat Nov 07, 2009 12:01 am

I see that when I view source, but I don't see the validator complaining about that. The only validator error message I've seen is about a <style> block in <body> which seemed to be a different theme than the one you wanted to validate.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest