This snippet shows (replacement) content for users without Javascript, similar to the <noscript> tag.

<SCRIPT> document.write('<style type="text/css">#no_js{display:none;}</style>'); </SCRIPT>
<TAG id="no_js"> Content for users without Javascript </TAG>
<SCRIPT> var x=document.getElementById("no_js");x.parentNode.removeChild(x); </SCRIPT>
  • Line 1 hides the Content of line 2 with CSS.
  • Line 3 additionally removes the content - for Browsers without CSS but with Javascript.

I wonder whether line 3 is academic and can be left out.

Are there real world users around with no CSS but Javascript ?

Related posts:

Why not noscript tag

Avoid flickering

没有正确的解决方案

其他提示

There's no reason to assume anyone would intentionally disabled CSS for normal browsing. Historically, there were reasons people would have javascript disabled, such as security or performance, but that shouldn't be a concern with CSS. If there's a device using your site that doesn't have CSS, you certainly shouldn't plan on it using javascript.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top