1.仕様
META要素は、
他のメタ関連要素で
表すことができない
任意のメタデータを
表します。
- meta
-
一般的なメタ情報 (generic metainformation)
- 種類
-
空要素
任意のコンテンツを持つことができない要素です。
- カテゴリ
-
- メタデータ
コンテンツ - フロー
コンテンツ (条件付き) - フレージング
コンテンツ (条件付き)
itemprop属性が存在する場合は、フローコンテンツ, フレージングコンテンツ。
- メタデータ
- 使用できるコンテキスト
-
- head
要素 に 0個以上 - head
要素 の子であるnoscript要素 に 0個以上 - メタデータ
コンテンツ を受け入れる要素 - フレージング
コンテンツ を受け入れる要素
head
要素 に 0個以上を そのコンテンツとして、使用できます。
head要素 の子であるnoscript要素 に 0個以上を そのコンテンツとして、使用できます。
メタデータコンテンツ を受け入れる要素のコンテンツとして、使用できます。
フレージングコンテンツ を受け入れる要素のコンテンツとして、使用できます。メタデータ
コンテンツ を受け入れる要素は、head要素 です。フレージング
コンテンツ を受け入れる要素は、h1要素 , h2要素 , h3要素 , h4要素 , h5要素 , h6要素 , p要素 , pre要素 , output要素 , progress要素 , meter要素 , label要素 , datalist要素 , body要素 , section要素 , nav要素 , aside要素 , article要素 , header要素 , footer要素 , main要素 , address要素 , li要素 , dt要素 , dd要素 , caption要素 , th要素 , td要素 , form要素 , fieldset要素 , search要素 , blockquote要素 , figure要素 , figcaption要素 , div要素 , dialog要素 , abbr要素 , b要素 , bdi要素 , bdo要素 , cite要素 , code要素 , data要素 , dfn要素 , em要素 , i要素 , kbd要素 , mark要素 , q要素 , s要素 , samp要素 , small要素 , span要素 , strong要素 , sub要素 , sup要素 , u要素 , var要素 です。charset 属性が存在する場合、または要素の http-equiv 属性が Encoding 宣言状態にある場合は、head 要素内。
http-equiv 属性が存在するが、Encoding 宣言状態にない場合は、head 要素内。
http-equiv 属性が存在するが Encoding 宣言状態にない場合は、head 要素の子である noscript 要素内。
name 属性が存在する場合は、メタデータのコンテンツが期待される場所。
itemprop 属性が存在する場合は、メタデータ コンテンツが期待される場所。
itemprop 属性が存在する場合は、フレージングコンテンツが期待される場所。
- head
- コンテンツモデル
-
何もない
要素のコンテンツモデルが「何もない」の場合、要素にはテキストノード (要素間の空白以外) と要素ノードが含まれていてはなりません。
- タグの省略
-
終了タグはありません。
- コンテンツ属性
-
グローバル属性 他
- name
属性 - メタデータ名
- http-equiv
属性 - プラグマディレクティブ
- content
属性 - 要素の値
- charset
属性 - 文字エンコーディング
- media
属性 - 対応メディア
scheme属性がありましたが、廃止されました。フィールドごとに 1 つのスキームのみを使用するか、スキーム宣言を値の一部にしてください。
- name
- DOM インターフェイス
-
HTMLMetaElement
[Exposed=Window]
interface HTMLMetaElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute DOMString name;
[CEReactions] attribute DOMString httpEquiv;
[CEReactions] attribute DOMString content;
[CEReactions] attribute DOMString media;
// also has obsolete members
};
HTMLElement
[Exposed=Window]
interface HTMLElement : Element {
[HTMLConstructor] constructor();
// metadata attributes
[CEReactions] attribute DOMString title;
[CEReactions] attribute DOMString lang;
[CEReactions] attribute boolean translate;
[CEReactions] attribute DOMString dir;
// user interaction
[CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
[CEReactions] attribute DOMString inert;
undefined click();
[CEReactions] attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString autocapitalize;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
ElementInternals attachInternals();
// The popover API
undefined showPopover();
undefined hidePopover();
boolean togglePopover(optional boolean force);
[CEReactions] attribute DOMString? popover;
};
HTMLElement includes GlobalEventHandlers;
HTMLElement includes ElementContentEditable;
HTMLElement includes HTMLOrSVGElement;
Element
[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString tagName;
[CEReactions] attribute DOMString id;
[CEReactions] attribute DOMString className;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
[CEReactions, Unscopable] attribute DOMString slot;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Attr? getAttributeNode(DOMString qualifiedName);
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
[CEReactions] Attr? setAttributeNode(Attr attr);
[CEReactions] Attr? setAttributeNodeNS(Attr attr);
[CEReactions] Attr removeAttributeNode(Attr attr);
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
undefined insertAdjacentText(DOMString where, DOMString data); // legacy
};
GlobalEventHandlers
interface mixin GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onauxclick;
attribute EventHandler onbeforeinput;
attribute EventHandler onbeforematch;
attribute EventHandler onbeforetoggle;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextmenu;
attribute EventHandler oncontextrestored;
attribute EventHandler oncopy;
attribute EventHandler oncuechange;
attribute EventHandler oncut;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
attribute EventHandler ondragenter;
attribute EventHandler ondragleave;
attribute EventHandler ondragover;
attribute EventHandler ondragstart;
attribute EventHandler ondrop;
attribute EventHandler ondurationchange;
attribute EventHandler onemptied;
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler onformdata;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LegacyLenientThis] attribute EventHandler onmouseenter;
[LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onpaste;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onscrollend;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onslotchange;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
attribute EventHandler onwebkitanimationend;
attribute EventHandler onwebkitanimationiteration;
attribute EventHandler onwebkitanimationstart;
attribute EventHandler onwebkittransitionend;
attribute EventHandler onwheel;
};
ElementContentEditable
interface mixin ElementContentEditable {
[CEReactions] attribute DOMString contentEditable;
[CEReactions] attribute DOMString enterKeyHint;
readonly attribute boolean isContentEditable;
[CEReactions] attribute DOMString inputMode;
};
HTMLOrSVGElement
interface mixin HTMLOrSVGElement {
[SameObject] readonly attribute DOMStringMap dataset;
attribute DOMString nonce; // intentionally no [CEReactions]
[CEReactions] attribute boolean autofocus;
[CEReactions] attribute long tabIndex;
undefined focus(optional FocusOptions options = {});
undefined blur();
};
- ARIA in HTML
-
暗黙的="
No
" ARIAロール="No
" aria-* 属性="No
"暗黙的な ARIAセマンティクスがありませんが、意味はあり、この意味は、ARIA によって提供されず、ARIA のユーザーに公開されていないロール、状態、プロパティで表現される可能性があります。
作成者は、暗黙的な ARIAセマンティクス, または HTML要素のネイティブセマンティクスを上書きしてはいけません。
記述できる aria-* 属性はありません。
- レンダリング
- ボックスを生成しない
非表示の要素
meta {
display: none;
}
CSS を大雑把に読むと、 要素とその子孫はボックスやテキストシーケンスを生成しません。 などになります。
- 説明
-
meta
要素 は、他のメタ関連要素で表す事が出来ない任意のメタデータを表します。meta
要素 は、name属性を持つドキュメントレベルのメタデータ、http-equiv属性を持つプラグマディレクティブ、およびcharset属性を使用して HTML文書が文字列形式にシリアル化されたときのファイルの文字エンコーディング宣言、を表す事が出来ます。<!DOCTYPE html>
<html lang=
"ja"> <head>
<meta charset=
"utf-8"> <title>meta要素の例 - (Example of meta element) | 離珠のHTMLでしぃ!</title>
</head>
<body>
<h1>meta要素の例</h1>
<p>この例の meta要素は、文書で使用される文字エンコーディングを utf-8 と指定しています。</p>
</body>
</html>
このサンプルへのリンクです。
(./exmeta.htm) - 参照元
-
参照元
- HTML Living Standard. 4.2.5 The meta element (Last Updated 27 August 2024)
- HTML Living Standard. 15 Rendering 15.3.1 Hidden elements (Last Updated 27 August 2024)
- HTML 5.2 W3C 勧告. 4.2.5 The meta element (W3C勧告、2017年12月14日)
- HTML 5.2 W3C 勧告. 10.3.1. Hidden elements (W3C勧告、2017年12月14日)
- HTML 5.1 W3C 勧告. 4.2.5 The meta element (W3C勧告、2016年11月1日)
- HTML 5.1 W3C 勧告. 10.3.1. Hidden elements (W3C勧告、2016年11月1日)
- HTML 5 W3C 勧告. 4.2.5 The meta element (W3C勧告、2014年10月28日)
- HTML 5 W3C 勧告. 10.3.1. Hidden elements (W3C勧告、2014年10月28日)
- HTML 4.01 Specification W3C 勧告. 7.4.4.2 The META element (W3C勧告1999年12月24日)
- HTML 3.2 Reference Specification META (W3C勧告1997年1月14日)
- Hypertext Markup Language - 2.0 (November 1995)
- <meta>: メタデータ要素 - HTML: ハイパーテキストマークアップ言語 | MDN
- JSONデータ
-
JSON形式での、データのイメージです。
{
"meta": {
"check": "2024-09-01",
"group": "Metadata",
"element": "- X EMPTY -- generic metainformation. (Void elements.) [Metadata|FlowLimited|PhrasingLimited] --",
"attlist": {
"%Global;": "",
"http-equiv": "NAME #IMPLIED -- HTTP response header name --",
"name": "NAME #IMPLIED -- metainformation name --",
"content": "CDATA #REQUIRED -- associated information --",
"charset": "CDATA #IMPLIED -- Character encoding declaration --",
"media": "%MediaDesc; #IMPLIED -- Applicable media --",
},
"comment": "一般的なメタ情報 (generic metainformation)",
"point": "他のメタ関連要素で表す事が出来ない任意のメタデータを表します。",
"description": "name属性を持つドキュメントレベルのメタデータ、http-equiv属性を持つプラグマディレクティブ、およびcharset属性を使用して HTML文書が文字列形式にシリアル化されたときのファイルの文字エンコーディング宣言、を表す事が出来ます。",
"kind": "Void",
"categories": [
"Metadata",
"FlowLimited",
"PhrasingLimited",
],
"categoriessupplement": "itemprop属性が存在する場合は、フローコンテンツ, フレージングコンテンツ。",
"used": [
"HEAD (META)*",
"HEAD NOSCRIPT (META)*",
"parent (%Metadata)*",
"parent (%Phrasing)*",
],
"usedsupplement": [
"charset 属性が存在する場合、または要素の http-equiv 属性が Encoding 宣言状態にある場合は、head 要素内。",
"http-equiv 属性が存在するが、Encoding 宣言状態にない場合は、head 要素内。",
"http-equiv 属性が存在するが Encoding 宣言状態にない場合は、head 要素の子である noscript 要素内。",
"name 属性が存在する場合は、メタデータのコンテンツが期待される場所。",
"itemprop 属性が存在する場合は、メタデータ コンテンツが期待される場所。",
"itemprop 属性が存在する場合は、フレージングコンテンツが期待される場所。",
],
"contentmodel": "%Nothing",
"tag": [
"-",
"X",
],
"attributes": {
"name": "メタデータ名",
"http-equiv": "プラグマディレクティブ",
"content": "要素の値",
"charset": "文字エンコーディング",
"media": "対応メディア",
},
"attributessupplement": [
"scheme属性がありましたが、廃止されました。フィールドごとに 1 つのスキームのみを使用するか、スキーム宣言を値の一部にしてください。",
],
"dominterface": "HTMLMetaElement",
"rendering": "Hidden",
"reference": [
{
"title": "HTML Living Standard. 4.2.5 The meta element.",
"href": "https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element",
"heading": "HTML Living Standard. 4.2.5 The meta element",
"sub": "Last Updated 27 August 2024",
},
{
"title": "HTML Living Standard. 15 Rendering 15.3.1 Hidden elements.",
"href": "https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements",
"heading": "HTML Living Standard. 15 Rendering 15.3.1 Hidden elements",
"sub": "Last Updated 27 August 2024",
},
{
"title": "HTML 5.2 W3C Recommendation. 4.2.5 The meta element. W3C Recommendation, 14 December 2017.",
"href": "https://www.w3.org/TR/2017/REC-html52-20171214/document-metadata.html#the-meta-element",
"heading": "HTML 5.2 W3C 勧告. 4.2.5 The meta element",
"sub": "W3C勧告、2017年12月14日",
},
{
"title": "HTML 5.2 W3C Recommendation. 10.3.1. Hidden elements.",
"href": "https://www.w3.org/TR/2017/REC-html52-20171214/rendering.html#hidden-elements",
"heading": "HTML 5.2 W3C 勧告. 10.3.1. Hidden elements",
"sub": "W3C勧告、2017年12月14日",
},
{
"title": "HTML 5.1 W3C Recommendation. 4.2.5 The meta element. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/document-metadata.html#the-meta-element",
"heading": "HTML 5.1 W3C 勧告. 4.2.5 The meta element",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "HTML 5.1 W3C Recommendation. 10.3.1. Hidden elements. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/rendering.html#hidden-elements",
"heading": "HTML 5.1 W3C 勧告. 10.3.1. Hidden elements",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "HTML 5 W3C Recommendation. 4.2.5 The meta element. W3C Recommendation, 28 October 2014.",
"href": "https://www.w3.org/TR/2014/REC-html5-20141028/document-metadata.html#the-meta-element",
"heading": "HTML 5 W3C 勧告. 4.2.5 The meta element",
"sub": "W3C勧告、2014年10月28日",
},
{
"title": "HTML 5 W3C Recommendation. 10.3.1. Hidden elements. W3C Recommendation, 28 October 2014.",
"href": "https://www.w3.org/TR/2014/REC-html5-20141028/rendering.html#hidden-elements",
"heading": "HTML 5 W3C 勧告. 10.3.1. Hidden elements",
"sub": "W3C勧告、2014年10月28日",
},
{
"title": "HTML 4.01 Specification W3C Recommendation. 7.4.4.2 The META element. W3C Recommendation 24 December 1999.",
"href": "https://www.w3.org/TR/html401/struct/global.html#h-7.4.4.2",
"heading": "HTML 4.01 Specification W3C 勧告. 7.4.4.2 The META element",
"sub": "W3C勧告1999年12月24日",
},
{
"title": "HTML 3.2 Reference Specification. W3C Recommendation 14-Jan-1997.",
"href": "https://www.w3.org/TR/2018/SPSD-html32-20180315/#meta",
"heading": "HTML 3.2 Reference Specification META",
"sub": "W3C勧告1997年1月14日",
},
{
"title": " Hypertext Markup Language - 2.0. November 1995.",
"href": "https://www.ietf.org/rfc/rfc1866.txt",
"heading": "Hypertext Markup Language - 2.0",
"sub": "November 1995",
},
{
"title": "MDN Web Docs. HTML <meta>: The metadata element.",
"href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/meta",
"heading": "<meta>: メタデータ要素 - HTML: ハイパーテキストマークアップ言語 | MDN",
},
],
"version": {
"first": "HTML2",
"latest": "HTML Living Standard",
},
}
}
注意: 簡易に描画する為に、各項目の後ろに
,
を付与しています。JSON の形式では、末尾の項目の後には,
は付けません。 - 最終確認日
-
2024-09-01
2.使用できるコンテキスト
meta要素は、
head要素に
使用できます。
meta
name
itemprop
文字エンコード宣言を含む要素は、ドキュメントの最初の 1024バイト内で完全にシリアル化する必要があります。この事から文字エンコード宣言を含む要素は、head
メタデータ
フレージング
- h1
要素 - h2
要素 - h3
要素 - h4
要素 - h5
要素 - h6
要素 - p
要素 - pre
要素 - output
要素 - progress
要素 - meter
要素 - label
要素 - datalist
要素 - body
要素 - section
要素 - nav
要素 - aside
要素 - article
要素 - header
要素 - footer
要素 - main
要素 - address
要素 - li
要素 - dt
要素 - dd
要素 - caption
要素 - th
要素 - td
要素 - form
要素 - fieldset
要素 - search
要素 - blockquote
要素 - figure
要素 - figcaption
要素 - div
要素 - dialog
要素 - abbr
要素 - b
要素 - bdi
要素 - bdo
要素 - cite
要素 - code
要素 - data
要素 - dfn
要素 - em
要素 - i
要素 - kbd
要素 - mark
要素 - q
要素 - s
要素 - samp
要素 - small
要素 - span
要素 - strong
要素 - sub
要素 - sup
要素 - u
要素 - var
要素
charset
http-equiv
name
itemprop
<head>
<meta charset=
"UTF-8"> <title>離珠のHTMLでしぃ!</title>
</head>
charset
<head>
<meta http-equiv=
"Content-Type" content= "text/html; charset=UTF-8"> <title>離珠のHTMLでしぃ!</title>
</head>
http-equiv
<head>
<meta charset=
"UTF-8"> <title>離珠のHTMLでしぃ!</title>
<meta http-equiv=
"x-ua-compatible" content= "IE=edge"> <noscript>
<meta http-equiv=
"Refresh" content= "300"> </noscript>
</head>
http-equiv
この例示は、配置のみを提示しています。意味(実用)は意識していません。
<head>
<meta charset=
"UTF-8"> <title>離珠のHTMLでしぃ!</title>
<meta name=
"viewport" content= "width=device-width, initial-scale=1 "></head>
name
<head>
<meta charset=
"UTF-8"> <title>離珠のHTMLでしぃ!</title>
</head>
<body>
<div itemscope>
<meta itemprop=
"test" content= "123"> </div>
</body>
itemprop
(itemprop
3.コンテンツモデル
meta要素
は、
配置可能なコンテンツは
ありません。
meta
meta
meta
4.コンテンツ属性
meta要素は、
グローバル属性と、
charset,
http-equiv,
name,
content,
media を
設定できます。
meta
各属性の有無, 内容により、meta
name
name
scheme
charset属性
<meta charset=
"utf-8">
charset
charset
charset
charset
属性値の"UTF-8"
の例示は推奨でもありますが、その文書の文字エンコーディングと一致である必要もあります。文書の都合で他の文字エンコーディングである必要がある場合は、別途にお調べ下さい。
http-equiv属性
<meta http-equiv=
"Content-Type" content= "text/html; charset=UTF-8"> <meta http-equiv=
"Content-Style-Type" content= "text/css"> <meta http-equiv=
"Content-Script-Type" content= "text/javascript">
http-equiv
meta
"Content-Type"
は文書の MIME type を定義するもので、後に文字"Content-Style-Type"
はデフォルトのスタイルシート言語を定義するものです。"Content-Script-Type"
はデフォルトのスクリプト言語を定義するものです。
文字
"Content-Type"
は後に文字エンコーディングの定義が続くので、head
http-equiv
上記の3点以外にも HTML5 で有効な属性値はあります。
http-equiv
name属性
<meta name=
"viewport" content= "width=device-width,initial-scale=1">
name
name
name
この例示では"viewport"
について例示しています。これは、ページのサイズとスケーリングの制御方法についてブラウザに指示を与えます。
content属性
<meta name=
"viewport" content= "width=device-width,initial-scale=1">
content
media属性
<meta name=
"theme-color" content= "#3c790a" media= "(prefers-color-scheme: dark)">
media
この例示は、HTML Living Standard.にあった記述です。筆者(私)は理解しきれていないので、そのままというか切り抜きの様に転記しました。 詳細は仕様をお読みください。この辺は必要に応じて学ばないと、難しいかと思います。
itemprop属性
<div itemscope>
<meta itemprop=
"test" content= "123"> </div>
itemprop
itemprop
5.DOM インターフェイス
meta要素
を
直接表す
プロパティは
ありません。
metadocument
のquerySelectorAll()メソッドを用いて要素meta
と指定して、meta
他には、namedocument
のgetElementsByName()メソッドを用いるとか、iddocument
のgetElementById()メソッドを用いるとか、状況, 目的によりいろいろあります。
このページの説明は、
"〇〇
"です。
<p>このページの説明は、
"<code id=
"icdJs501">〇〇</code>"です。</p> <script>
document
.addEventListener( "DOMContentLoaded", function() { var vaMeta = document
.querySelectorAll( ;"meta") for (var i = 0; i < vaMeta.length; i++){
if (vaMeta[i].getAttribute(
"name") == "description") document
.getElementById( "icdJs501") . textContent
= vaMeta[i].getAttribute("content"); });
</script>
metadescription
である要素のcontent
6.レンダリング
meta {
display: none;
}
metanone
であり、この要素とその子孫はボックスやテキスト
メタデータを記述する為の要素なので、ボックスを生成する様な指定は行わないのが良いでしょう。
<div class=
"cdvPseudo601" itemscope> <meta itemprop=
"pmeTest" content= "123"> </div>
<style>
.cdvPseudo601 meta,
.cdvPseudo601 meta::after {
display: block;
}
.cdvPseudo601 meta::after {
content: attr(itemprop) "," attr(content);
}
</style>
メタデータを記述する空要素を表示する例のつもりです。表示する予定であれば、メタデータとしてではなく表示用でもあるデータとして別の要素で記述しておくのが良いかと思います。例として記述してみても、なんか変かなと思います。まぁ技術的な可能性としての知識として見てください。
7.気を付ける点
文字エンコーディング宣言
文字
<!DOCTYPE html>
<html lang=
"ja"> <head>
<meta charset=
"UTF-8"> <title>離珠のHTMLでしぃ!</title>
<meta name=
"viewport" content= "width=device-width, initial-scale=1 ">以下、つづく
まず文書型宣言を記述して、それに続いてhtml
処理順序
HTMLは、タグ等の解釈, 処理を読み込み順に行います。メタデータを記述しても、まだ読み込んでない部分はその時点では無いものとして解釈, 処理を行うので、大事な事は先に記述します。
一部の要素(その属性等)で、処理順序を制御する指定もありますが、それもその記述が読まれてその処理によって制御が有効となるのであって、やはり記述順には意味があります。