如何在noscript中添加链接标记标记其显示 [英] How to add link tag inside noscript tag its showing

查看:77
本文介绍了如何在noscript中添加链接标记标记其显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在标签内添加了如下标签:

 < noscript> 
< link type =text / css =stylesheethref =$ {staticFilesUrl} /css/noscript-overrule.css/>
< / noscript>

但在Firefox启用javascript时,我看到类似这样的内容

 < noscript> 
& lt; link type =text / css =stylesheethref =/ static / snsbank / css / noscript-overrule.css/& gt;
< / noscript>

事件我试图将样式标记放入noscript标记中仍然保留在Firefox中我得到以下结果 p>

 < noscript> 
& lt;风格& gt; #whiteBox {width:30%; &安培; LT /风格&安培; GT;
< / noscript>

任何人都可以告诉我如何避免这种情况?

解决方案

您在评论中提问:如果我只想在禁用javascript的情况下使用一个css文件,那我该怎么办?



至少有两种方法(可能更多):


  1. 有一个默认样式表,总是加载。然后,如果启用了javascript,请在​​中使用< script> 标签在默认情况下覆盖样式。

  2. 如果你只是改变了一些东西,有一个样式表并且在 body of NoJavascriptEnabled ,您可以在javascript未启用时用于定位这些少数样式,然后使用javascript来删除 该类如果启用了javascript。



I added tag inside the tag as following

<noscript>
    <link type="text/css" rel="stylesheet" href="${staticFilesUrl}/css/noscript-overrule.css" />
</noscript>

but in firefox when the javascript is enabled I see something like this

<noscript>
      &lt; link type="text/css" rel="stylesheet" href="/static/snsbank/css/noscript-overrule.css" /&gt;
</noscript>

event I tried to put style tag inside the noscript tag still in firefox I got the following result

<noscript>
    &lt; style &gt; #whiteBox{ width:30%; &lt/style&gt;
</noscript>

can anyone tell me how can I avoid this?

解决方案

You ask in a comment: "if I want to use one css file only if javascript is disabled then what should I do?"

Two ways at least (probably more):

  1. Have a default stylesheet that is for without javascript that always loads. Then, if javascript is enabled, use a <script> tag in the head to load a different stylesheet after the default to override the styles.

  2. If you just have a few things that change, have one style sheet and have a class on your body of NoJavascriptEnabled that you use to target those few styles when javascript is not enabled, and then use javascript to remove that class if javascript is enabled.

这篇关于如何在noscript中添加链接标记标记其显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆