Load alternate CSS when JavascriptJQuery is disabled - Stack Overflow

I've been doing a lot of searching and haven't quite found the solution to my problem.What

I've been doing a lot of searching and haven't quite found the solution to my problem.

What I'm trying to do, is have two CSS style sheets for a website. One style sheet for when javascript or jQuery is enabled, and one for when it is disabled. How would I go about doing this?

I've been doing a lot of searching and haven't quite found the solution to my problem.

What I'm trying to do, is have two CSS style sheets for a website. One style sheet for when javascript or jQuery is enabled, and one for when it is disabled. How would I go about doing this?

Share Improve this question asked Nov 19, 2010 at 0:24 JandaJanda 211 bronze badge
Add a ment  | 

2 Answers 2

Reset to default 9

Use something like this:

<noscript>
<link type="text/css" href="noscript.css" rel="stylesheet" />
</noscript>

Hope this helps!

EDIT

For when JS is enabled, just create the <link> tag using JS. (document.write(...);)

Your second stylesheet can just override whatever is in the first. Past (after) that, just include the second inside a <noscript> tag, like this:

<noscript>
  <link rel="stylesheet" type="text/css" href="myStyles.css">
</noscript>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745356300a4624139.html

相关推荐

  • Load alternate CSS when JavascriptJQuery is disabled - Stack Overflow

    I've been doing a lot of searching and haven't quite found the solution to my problem.What

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信