Page 1 of 1

Problem serving alternate stylesheet, noscript == no valid

Posted: Sun May 17, 2009 5:08 pm
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.

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

Posted: Sun May 17, 2009 7:55 pm
by Gabriel
Try this:

Code: Select all

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