noscript要素
の仕様


noscript
スクリプトが無効な場合の為のマークアップ (alternate content container for non script-based rendering)
種類
通常要素
レンダ
リング
ボックスを生成しない
非表示の要素
  1. noscript {
  2. display: none;
  3. }

CSS を大雑把に読むと、 要素とその子孫は、ボックスやテキストランを生成しません。 などになります。

使用できる状態
noscript要素を祖先に持たないhead要素
noscript要素を祖先に持たないフレージングコンテンツを受け入れる要素。
許可されている内容
head要素内の時、(link要素 | style要素 | meta要素)*
head要素内でない場合は、透過的コンテンツです。
タグの省略
省略できません。
許可されているARIA
なし[No corresponding role]
属性

グローバル属性のみ

DOM
HTMLElement
  1. [Exposed=Window]
  2. interface HTMLElement : Element {
  3. [HTMLConstructor] constructor();
  4.  
  5. (一部省略)
  6. };
PUG
_template.pug
  1. block variable
  2. block document
  3. doctype html
  4. html(lang="ja")
  5. head
  6. block head
  7. meta(charset="UTF-8")
  8. title 離珠のHTMLでしぃ!
  9. noscript
  10. meta(http-equiv="Content-Style-Type" content="text/css")
  11. link(rel="stylesheet" href="./risyu.css")
  12. style
  13. | body { color: white; background-color: teal; }
  14. body
  15. block body
  16. | noscript要素のサンプル用ページです。
説明
noscript要素は、スクリプトが有効な場合は何も表さず、スクリプトが無効な場合はその子を表します。

これは、ドキュメントの解析方法に影響を与えることにより、スクリプトをサポートするユーザーエージェントとスクリプトをサポートしないユーザーエージェントに異なるマークアップを提示する為に使用されます。

noscript要素」のページで改めて詳細に記述しています。

  1. <!DOCTYPE html>
  2. <html lang="ja">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>離珠のHTMLでしぃ!</title>
  6. <noscript>
  7. <meta http-equiv="Content-Style-Type" content="text/css">
  8. <link rel="stylesheet" href="./risyu.css">
  9. <style>
  10. body { color: white; background-color: teal; }
  11. </style>
  12. </noscript>
  13. </head>
  14. <body>
  15. noscript要素のサンプル用ページです。
  16. </body>
  17. </html>
最終確認日
2022-07-27