Validating non-javascript version


I’m using noscript for a non-js version. The XHTML 1.0 validator doesn’t seem to like the style element within <noscript>

Are there any workarounds for this?

            <style type="text/css">

            styles here


<noscript> is obsolete. Using JavaScript provides a more flexible alternative.

  1. Styles are only allowed in the <head>
  2. <noscript was only allowed in the body. HTML 5 allows it anywhere but it hasn’t been necessary to use it at all since Netscape 4.

To style differently when JavaScript is not available add class=nojs" to the <head> tag and use that class as part of all your no JavaScript styling in your regular CSS file.

Then simply include a one line JavaScript in the head of the page that removes the nojs class from the head tag.

Thanks for the response. We are soon moving to HTML 5 where noscript will be allowed in <head>.

I’m just wondering if there is some kind of “hack” or workaround to make it compliant with XHTML 1.0 Strict, without modifying the code very much.

Even though you are moving soon to HTML 5, are you going to restrict access from all browsers that don’t handle HTML 5? It is normally a better practice to ensure that your techniques are widely accessible.

Just because they allow an obsolete tag to be used anywhere doesn’t mean you should use it.

See for a one line JavaScript that allows you to style the entire page completely differently depending on whether JavaScript is enabled or not without needing the obsolete noscript tag.