[英]Load alternate CSS when Javascript/JQuery is disabled
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. 我正在尝试做的是,有一个网站的两个CSS样式表。 One style sheet for when javascript or jQuery is enabled, and one for when it is disabled.
启用javascript或jQuery时的一个样式表,以及启用javascript或jQuery时的样式表。 How would I go about doing this?
我该怎么做呢?
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. 对于在启用 JS,刚刚创建
<link>
使用JS标签。 ( document.write(...);
) (
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>
标签中包含第二个,如下所示:
<noscript>
<link rel="stylesheet" type="text/css" href="myStyles.css">
</noscript>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.