Problem serving alternate stylesheet, noscript == no valid

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Problem serving alternate stylesheet, noscript == no valid

Post by Sindarin »

I am using jQuery to create some slide down animation effects in my site, but as I have the class .divcontainer with attribute display:none, whoever doesn't have javascript enabled won't be able to read the content. So I thought to provide an alternate stylesheet for those with no javascript support,

Code: Select all

<noscript>
<link rel="stylesheet" type="text/css" href="files/stylesheets/noscript.css" />
</noscript>
easily by using the noscript tag. However the noscript tag on head is not valid on head, so I put it in the body but the link/style tag is invalid then. (way to go w3c...)
so is there any solution for this? I tried:

Code: Select all

<script type="text/javascript">
<!--
document.write('<link rel="stylesheet" href="site-layout.css" type="text/css" media="screen" />
');
-->
</script>
It validates but the problem is the divs are visible at start which defeats the purpose.
User avatar
Gabriel
Forum Commoner
Posts: 41
Joined: Wed May 06, 2009 8:12 pm
Location: Las Vegas

Re: Problem serving alternate stylesheet, noscript == no valid

Post by Gabriel »

Try this:

Code: Select all

<noscript>
<style type="text/css">
@import url('files/stylesheets/noscript.css');
</style>
</noscript>
Post Reply