メインコンテンツへスキップ

article要素


1.仕様

ARTICLE要素は、
ドキュメント、ページ、
アプリケーション、
またはサイトの
完全なまたは自己完結型の
構成を
表します。

ARTICLE - - (%Flow)* -- article section. (Normal elements.) [Flow|Sectioning|Palpable] --

article

記事コンテンツ (article section)

種類

通常要素

使用できるコンテキスト
セクショニングコンテンツを受け入れる要素

セクショニングコンテンツを受け入れる要素のコンテンツとして、使用できます。

セクショニングコンテンツを受け入れる要素は、<body>要素, <section>要素, <nav>要素, <aside>要素, <article>要素, <header>要素, <footer>要素, <main>要素, <li>要素, <dd>要素, <caption>要素, <td>要素, <form>要素, <fieldset>要素, <search>要素, <blockquote>要素, <figure>要素, <figcaption>要素, <div>要素, <dialog>要素, <details>要素 です。

タグの省略

どちらのタグも省略できません。

コンテンツ属性

グローバル属性のみ

DOM インターフェイス
HTMLElement
  1. [Exposed=Window]
  2. interface HTMLElement : Element {
  3. [HTMLConstructor] constructor();
  4.  
  5. // metadata attributes
  6. [CEReactions] attribute DOMString title;
  7. [CEReactions] attribute DOMString lang;
  8. [CEReactions] attribute boolean translate;
  9. [CEReactions] attribute DOMString dir;
  10.  
  11. // user interaction
  12. [CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
  13. [CEReactions] attribute DOMString inert;
  14. undefined click();
  15. [CEReactions] attribute DOMString accessKey;
  16. readonly attribute DOMString accessKeyLabel;
  17. [CEReactions] attribute boolean draggable;
  18. [CEReactions] attribute boolean spellcheck;
  19. [CEReactions] attribute DOMString writingSuggestions;
  20. [CEReactions] attribute DOMString autocapitalize;
  21.  
  22. [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
  23. [CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
  24.  
  25. ElementInternals attachInternals();
  26.  
  27. // The popover API
  28. undefined showPopover();
  29. undefined hidePopover();
  30. boolean togglePopover(optional boolean force);
  31. [CEReactions] attribute DOMString? popover;
  32. };
  33.  
  34. HTMLElement includes GlobalEventHandlers;
  35. HTMLElement includes ElementContentEditable;
  36. HTMLElement includes HTMLOrSVGElement;
Element
  1. [Exposed=Window]
  2. interface Element : Node {
  3. readonly attribute DOMString? namespaceURI;
  4. readonly attribute DOMString? prefix;
  5. readonly attribute DOMString localName;
  6. readonly attribute DOMString tagName;
  7.  
  8. [CEReactions] attribute DOMString id;
  9. [CEReactions] attribute DOMString className;
  10. [SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
  11. [CEReactions, Unscopable] attribute DOMString slot;
  12.  
  13. boolean hasAttributes();
  14. [SameObject] readonly attribute NamedNodeMap attributes;
  15. sequence<DOMString> getAttributeNames();
  16. DOMString? getAttribute(DOMString qualifiedName);
  17. DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
  18. [CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
  19. [CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
  20. [CEReactions] undefined removeAttribute(DOMString qualifiedName);
  21. [CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
  22. [CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
  23. boolean hasAttribute(DOMString qualifiedName);
  24. boolean hasAttributeNS(DOMString? namespace, DOMString localName);
  25.  
  26. Attr? getAttributeNode(DOMString qualifiedName);
  27. Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
  28. [CEReactions] Attr? setAttributeNode(Attr attr);
  29. [CEReactions] Attr? setAttributeNodeNS(Attr attr);
  30. [CEReactions] Attr removeAttributeNode(Attr attr);
  31.  
  32. ShadowRoot attachShadow(ShadowRootInit init);
  33. readonly attribute ShadowRoot? shadowRoot;
  34.  
  35. Element? closest(DOMString selectors);
  36. boolean matches(DOMString selectors);
  37. boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
  38.  
  39. HTMLCollection getElementsByTagName(DOMString qualifiedName);
  40. HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  41. HTMLCollection getElementsByClassName(DOMString classNames);
  42.  
  43. [CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
  44. undefined insertAdjacentText(DOMString where, DOMString data); // legacy
  45. };
GlobalEventHandlers
  1. interface mixin GlobalEventHandlers {
  2. attribute EventHandler onabort;
  3. attribute EventHandler onauxclick;
  4. attribute EventHandler onbeforeinput;
  5. attribute EventHandler onbeforematch;
  6. attribute EventHandler onbeforetoggle;
  7. attribute EventHandler onblur;
  8. attribute EventHandler oncancel;
  9. attribute EventHandler oncanplay;
  10. attribute EventHandler oncanplaythrough;
  11. attribute EventHandler onchange;
  12. attribute EventHandler onclick;
  13. attribute EventHandler onclose;
  14. attribute EventHandler oncontextlost;
  15. attribute EventHandler oncontextmenu;
  16. attribute EventHandler oncontextrestored;
  17. attribute EventHandler oncopy;
  18. attribute EventHandler oncuechange;
  19. attribute EventHandler oncut;
  20. attribute EventHandler ondblclick;
  21. attribute EventHandler ondrag;
  22. attribute EventHandler ondragend;
  23. attribute EventHandler ondragenter;
  24. attribute EventHandler ondragleave;
  25. attribute EventHandler ondragover;
  26. attribute EventHandler ondragstart;
  27. attribute EventHandler ondrop;
  28. attribute EventHandler ondurationchange;
  29. attribute EventHandler onemptied;
  30. attribute EventHandler onended;
  31. attribute OnErrorEventHandler onerror;
  32. attribute EventHandler onfocus;
  33. attribute EventHandler onformdata;
  34. attribute EventHandler oninput;
  35. attribute EventHandler oninvalid;
  36. attribute EventHandler onkeydown;
  37. attribute EventHandler onkeypress;
  38. attribute EventHandler onkeyup;
  39. attribute EventHandler onload;
  40. attribute EventHandler onloadeddata;
  41. attribute EventHandler onloadedmetadata;
  42. attribute EventHandler onloadstart;
  43. attribute EventHandler onmousedown;
  44. [LegacyLenientThis] attribute EventHandler onmouseenter;
  45. [LegacyLenientThis] attribute EventHandler onmouseleave;
  46. attribute EventHandler onmousemove;
  47. attribute EventHandler onmouseout;
  48. attribute EventHandler onmouseover;
  49. attribute EventHandler onmouseup;
  50. attribute EventHandler onpaste;
  51. attribute EventHandler onpause;
  52. attribute EventHandler onplay;
  53. attribute EventHandler onplaying;
  54. attribute EventHandler onprogress;
  55. attribute EventHandler onratechange;
  56. attribute EventHandler onreset;
  57. attribute EventHandler onresize;
  58. attribute EventHandler onscroll;
  59. attribute EventHandler onscrollend;
  60. attribute EventHandler onsecuritypolicyviolation;
  61. attribute EventHandler onseeked;
  62. attribute EventHandler onseeking;
  63. attribute EventHandler onselect;
  64. attribute EventHandler onslotchange;
  65. attribute EventHandler onstalled;
  66. attribute EventHandler onsubmit;
  67. attribute EventHandler onsuspend;
  68. attribute EventHandler ontimeupdate;
  69. attribute EventHandler ontoggle;
  70. attribute EventHandler onvolumechange;
  71. attribute EventHandler onwaiting;
  72. attribute EventHandler onwebkitanimationend;
  73. attribute EventHandler onwebkitanimationiteration;
  74. attribute EventHandler onwebkitanimationstart;
  75. attribute EventHandler onwebkittransitionend;
  76. attribute EventHandler onwheel;
  77. };
ElementContentEditable
  1. interface mixin ElementContentEditable {
  2. [CEReactions] attribute DOMString contentEditable;
  3. [CEReactions] attribute DOMString enterKeyHint;
  4. readonly attribute boolean isContentEditable;
  5. [CEReactions] attribute DOMString inputMode;
  6. };
HTMLOrSVGElement
  1. interface mixin HTMLOrSVGElement {
  2. [SameObject] readonly attribute DOMStringMap dataset;
  3. attribute DOMString nonce; // intentionally no [CEReactions]
  4.  
  5. [CEReactions] attribute boolean autofocus;
  6. [CEReactions] attribute long tabIndex;
  7. undefined focus(optional FocusOptions options = {});
  8. undefined blur();
  9. };
ARIA in HTML
暗黙的="article" ARIAロール="あり" aria-* 属性="GlobalAny"

暗黙的な ARIAセマンティクスは、role=article です。

作成者が要素に指定してもよい ARIAロール値は、 application, document, feed, main, none, presentation, region です。

グローバル aria-* 属性と、許可されたロールに適用される任意の aria-* 属性が記述できます。

レンダリング
ブロックボックス
セクション
  1. article {
  2. display: block;
  3. unicode-bidi: isolate;
  4. }

CSS を大雑把に読むと、 ブロックレベルのブロックコンテナボックス(ブロックボックス)を生成します。 などになります。

説明
article要素は、完全なまたは自己完結型の構成を表します。

article要素は、ドキュメント、ページ、アプリケーション、またはサイト内の完全な、または自己完結的な構成を表します。
原則として、たとえばシンジケーションで独立して配布または再利用できます。
article要素がネストされている場合、内側のarticle要素は、原則として外側の記事のコンテンツに関連する記事を表します。
article要素に関連付けられた著者情報 (address要素を参照) は、ネストされたarticle要素には適用されません。

  1. <!DOCTYPE html>
  2. <html lang="ja">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>article要素の例 - (Example of article element) | 離珠のHTMLでしぃ!</title>
  6. </head>
  7. <body>
  8. <h1>article要素の例</h1>
  9. <article>
  10. <h2>自己完結1</h2>
  11. 自己完結1の内容を記述します。
  12. </article>
  13. <article>
  14. <h2>自己完結2</h2>
  15. 自己完結2の内容を記述します。
  16. </article>
  17. </body>
  18. </html>

このサンプルへのリンクです。
(./exarticle.htm)

JSONデータ
JSON形式での、データのイメージです。
  1. {
  2. "article": {
  3. "check": "2024-09-01",
  4. "group": "Section",
  5. "element": "- - (%Flow)* -- article section. (Normal elements.) [Flow|Sectioning|Palpable] --",
  6. "attlist": {"%Global;": ""},
  7. "comment": "記事コンテンツ (article section)",
  8. "point": "完全なまたは自己完結型の構成を表します。",
  9. "description": [
  10. "ドキュメント、ページ、アプリケーション、またはサイト内の完全な、または自己完結的な構成を表します。",
  11. "原則として、たとえばシンジケーションで独立して配布または再利用できます。",
  12. "article要素がネストされている場合、内側のarticle要素は、原則として外側の記事のコンテンツに関連する記事を表します。",
  13. "article要素に関連付けられた著者情報 (address要素を参照) は、ネストされたarticle要素には適用されません。",
  14. ],
  15. "kind": "Normal",
  16. "categories": [
  17. "Flow",
  18. "Sectioning",
  19. "Palpable",
  20. ],
  21. "used": "parent (%Sectioning)*",
  22. "contentmodel": "article (%Flow)*",
  23. "tag": [
  24. "-",
  25. "-",
  26. ],
  27. "attributes": "Global",
  28. "dominterface": "HTMLElement",
  29. "rendering": [
  30. "Section",
  31. "Bidirectional",
  32. ],
  33. "reference": [
  34. {
  35. "title": "HTML Living Standard. 4.3.2 The article element.",
  36. "href": "https://html.spec.whatwg.org/multipage/sections.html#the-article-element",
  37. "heading": "HTML Living Standard. 4.3.2 The article element",
  38. "sub": "Last Updated 27 August 2024",
  39. },
  40. {
  41. "title": "HTML Living Standard. 15 Rendering 15.3.6 Sections and headings.",
  42. "href": "https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings",
  43. "heading": "HTML Living Standard. 15 Rendering 15.3.6 Sections and headings",
  44. "sub": "Last Updated 27 August 2024",
  45. },
  46. {
  47. "title": "HTML 5.2 W3C Recommendation. 4.3.2 The article element. W3C Recommendation, 14 December 2017.",
  48. "href": "https://www.w3.org/TR/2017/REC-html52-20171214/sections.html#the-article-element",
  49. "heading": "HTML 5.2 W3C 勧告. 4.3.2 The article element",
  50. "sub": "W3C勧告、2017年12月14日",
  51. },
  52. {
  53. "title": "HTML 5.2 W3C Recommendation. 10.3.7. Sections and headings.",
  54. "href": "https://www.w3.org/TR/2017/REC-html52-20171214/rendering.html#sections-and-headings",
  55. "heading": "HTML 5.2 W3C 勧告. 10.3.7. Sections and headings",
  56. "sub": "W3C勧告、2017年12月14日",
  57. },
  58. {
  59. "title": "HTML 5.1 W3C Recommendation. 4.3.2 The article element. W3C Recommendation, 1 November 2016.",
  60. "href": "https://www.w3.org/TR/2016/REC-html51-20161101/sections.html#the-article-element",
  61. "heading": "HTML 5.1 W3C 勧告. 4.3.2 The article element",
  62. "sub": "W3C勧告、2016年11月1日",
  63. },
  64. {
  65. "title": "HTML 5.1 W3C Recommendation. 10.3.7. Sections and headings. W3C Recommendation, 1 November 2016.",
  66. "href": "https://www.w3.org/TR/2016/REC-html51-20161101/rendering.html#sections-and-headings",
  67. "heading": "HTML 5.1 W3C 勧告. 10.3.7. Sections and headings",
  68. "sub": "W3C勧告、2016年11月1日",
  69. },
  70. {
  71. "title": "HTML 5 W3C Recommendation. 4.3.2 The article element. W3C Recommendation, 28 October 2014.",
  72. "href": "https://www.w3.org/TR/2014/REC-html5-20141028/sections.html#the-article-element",
  73. "heading": "HTML 5 W3C 勧告. 4.3.2 The article element",
  74. "sub": "W3C勧告、2014年10月28日",
  75. },
  76. {
  77. "title": "HTML 5 W3C Recommendation. 10.3.7 Sections and headings. W3C Recommendation, 28 October 2014.",
  78. "href": "https://www.w3.org/TR/2014/REC-html5-20141028/rendering.html#sections-and-headings",
  79. "heading": "HTML 5 W3C 勧告. 10.3.7 Sections and headings",
  80. "sub": "W3C勧告、2014年10月28日",
  81. },
  82. {
  83. "title": "MDN Web Docs. HTML <article>: The Article Contents element.",
  84. "href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/article",
  85. "heading": "<article>: 記事コンテンツ要素 - HTML: ハイパーテキストマークアップ言語 | MDN",
  86. },
  87. ],
  88. "version": {
  89. "first": "HTML5",
  90. "latest": "HTML Living Standard",
  91. },
  92. }
  93. }

注意: 簡易に描画する為に、各項目の後ろに , を付与しています。JSON の形式では、末尾の項目の後には , は付けません。

最終確認日

2024-09-01


2.使用できるコンテキスト

article要素は、
セクショニングコンテンツを
受け入れる要素に
使用できます。

<article>要素が使用できるコンテキスト(Context文脈)は、セクショニングコンテンツを受け入れる要素コンテンツとしてです。

<article>要素は、セクショニングコンテンツでありフローコンテンツでもあります。よって、コンテンツモデルフローコンテンツでありセクショニングコンテンツを受け入れる要素に配置できます。つまりコンテンツモデルセクショニングコンテンツを除くフローコンテンツを受け入れるという要素があって、それには配置できないという事です。

セクショニングコンテンツコンテンツの一部としては配置できないけれども、他のフローコンテンツコンテンツの一部として配置できる要素は、以下の各要素です。

body
article
  1. <body>
  2. <article>セクショニングコンテンツ</article>
  3. </body>

<body>要素のコンテンツの一部として、フローコンテンツである<article>要素を配置している例です。


3.コンテンツモデル

article要素は、
フローコンテンツを
配置できます。

<article>要素子や子孫としてどのようなコンテンツ(Content内容) が含まれなければならないかというと、0 以上のフローコンテンツです。

article
Flow
content
  1. <article>
  2. <p>フローコンテンツ</p>
  3. </article>

<article>要素のコンテンツの一部として、フローコンテンツである<p>要素を配置している例です。


4.コンテンツ属性

article要素 は、
グローバル属性のみ、
設定できます。

article要素に指定することができる属性は、グローバル属性のみ、設定できます。

class属性

  1. <article class="cseCss401">

class属性 は、その要素が属する様々なクラス(the various classes.)を指定するグローバル属性です。

HTML要素で指定される場合、class属性はその要素が属する様々なクラスを表す、空白で区切られたトークンの集合である値を持たなければなりません。

class属性のサンプル

5.DOM インターフェイス

article要素
直接表す
プロパティは
ありません。

article要素を JavaScript などで操作するには、documentgetElementById()メソッドを用いてid属性で指定して、article要素を取得する方法があります。この時に取得できる値の形式はHTMLElement インターフェイスです。

他には、documentquerySelectorAll()メソッドを用いて要素セレクタarticleと指定して用いるとか、name属性があればdocumentgetElementsByName()メソッドを用いるとか、状況, 目的によりいろいろあります。

この例示の文字の色は、です。
article要素の文字の色
  1. <form onchange="document.getElementById('iatJs501').style.color = document.getElementById('iseJs502').value;">
  2. この例示の文字の色は、<select id="iseJs502">
  3. <option value="inherit">継承する</option>
  4. <option value="red"></option>
  5. <option value="blue"></option>
  6. </select>です。
  7. </form>
  8. <article id="iatJs501">
  9. article要素の文字の色
  10. </article>

article要素id属性を指定して、そのid属性で要素を取得する例です。例示では、cssのcolorを選択して設定する処理としています。例示で動的に表示する為に、フォームの内容が変更された時に処理するコードとしています。


6.アクセシビリティ

article要素は、
ドキュメント、ページ、
またはサイトの独立した部分を
形成する構成で構成される
ページのセクションです。

<article>要素暗黙的なARIAセマンティクスは、role="article" となります。
`article` ロールは、次のようなランドマークを意味します:
ドキュメントページ、またはサイトの独立した部分を形成する構成で構成されるページセクションです。

記事はナビゲーションのランドマークではありませんが、ディスカッションを形成するためにネストされる場合があります。この場合、支援技術は記事のネストに注目し、ユーザーがディスカッションを追跡するのを支援できます。記事は、フォーラム投稿、雑誌や新聞の記事、ウェブログエントリ、ユーザーが投稿したコメント、またはその他の独立したコンテンツ項目である可能性があります。記事は、シンジケーションなど、コンテンツが単独で存在する可能性があるという点で独立しています。ただし、要素は依然としてその祖先と関連付けられています。たとえば、親の body 要素に適用される連絡先情報は、記事にも適用されます。記事をネストする場合、子記事は親記事のコンテンツに関連するコンテンツを表します。たとえば、ユーザーからのコメントを受け付けるサイトのウェブログエントリは、コメントをそのウェブログエントリの記事内にネストされた記事として表すことができます。記事に関連付けられている著者、見出し、日付などの情報は、ネストされた記事には適用されません。

ユーザーが記事の役割(role)を割り当てられた要素に移動すると、通常は標準キーボードイベントをインターセプトする支援技術は、キーボードイベントをウェブアプリケーションに渡すのではなく、ドキュメント閲覧モードに切り替えるべきです(SHOULD)。支援技術は、ユーザーがネストされた記事要素の階層をナビゲートできる機能を提供してもよい。

記事がフィードのコンテキスト内にある場合、作成者はaria-posinsetとaria-setsizeの値を指定してもよい。

作成者が<article>要素に明示的に指定可能なARIA ロール(役割)は以下のとおりです:
application, document, feed, main, none, presentation, region

ARIA の状態プロパティについては、すべての要素で使用できるグローバル`aria-*` 属性に加えて、上記のロールに応じて使用可能な`aria-*` 属性が許可されます。


7.レンダリング

  1. article {
  2. display: block;
  3. unicode-bidi: isolate;
  4. }

article要素ユーザーエージェントレベルスタイルシートデフォルトでは、displayプロパティの値は block であり、ブロックレベルブロックコンテナボックス(ブロックボックス) を生成します。

ブロックフォーマットコンテキストに参加して、ブロックフォーマットコンテキストを継承, 確立します。もし、インラインフォーマットコンテキストに参加するコンテンツのみを含む場合は、新しいインラインフォーマットコンテキストを確立します。次に、すべてのインラインコンテンツをラップするルートインラインボックスも生成します。

unicode-bidi は、置換されない要素のレンダリングでの Bidirectional text(双方向テキスト) に於いての期待される仕様の様です。


8.気を付ける点

意味

<article>要素は、見出しとフッターの範囲, 区分(セクション)を完全なまたは自己完結型の構成(セクション)として表す要素です。
構成(セクション)の関係性が判断しきれない場合は<section>要素を用いる事をお勧めします。
区分という意味を意識せずただ技術的に各要素をまとめたいだけ, スタイルシートやスクリプトの為にコンテナとして要素を置きたいだけなら、<div>要素を用いる事をお勧めします。