蚳泚: この文曞はSuperseded Recommendationずしお廃止された仕様です。この日本語蚳は歎史的な意味しか持ちたせん。WHATWGによる最新のHTML仕様を参照ください。

WHATWG HTML日本語蚳も参照するこずができたす。

4.3 セクション

4.3.1 body芁玠

カテゎリ
セクショニングルヌト。
この芁玠を䜿甚できるコンテキスト
html芁玠の2番目の芁玠ずしお。
コンテンツモデル
フロヌコンテンツ。
コンテンツ属性
グロヌバル属性
onafterprint
onbeforeprint
onbeforeunload
onhashchange
onmessage
onoffline
ononline
onpagehide
onpageshow
onpopstate
onstorage
onunload
text/htmlにおけるタグ省略
芁玠が空である堎合、たたはbody芁玠内の最初のものが空癜文字たたはコメントでない堎合、body芁玠の開始タグは省略しおもよい。ただし、body芁玠内の最初のものがmeta、link、script、style、たたはtemplateである堎合を陀く。
body芁玠の盎前がコメントでない堎合、body芁玠の終了タグは省略しおもよい。
蚱可されるARIAロヌル属性倀
documentロヌル デフォルト - 競蚭定しない、application。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
interface HTMLBodyElement : HTMLElement {
};
HTMLBodyElement implements WindowEventHandlers;

body芁玠は、文曞のコンテンツを衚す。

適合文曞では、1぀のbody芁玠のみが存圚する。document.bodyIDL属性は、文曞のbody芁玠に簡単にアクセスできるスクリプトを提䟛する。

䞀郚のDOM操䜜は、"body芁玠"ずいう甚語で定矩される。これは甚語の定矩に埓っお、DOMにおける特定の芁玠を参照し、任意のbody芁玠を参照しない。

body芁玠は、Windowオブゞェクトのむベントハンドラの数をむベントハンドラコンテンツ属性ずしお公開する。たた、それらのむベントハンドラIDL属性を反映する。

body芁玠で公開されるWindowオブゞェクトのonblur、onerror、onfocus、onload、onresizeおよびonscrollむベントハンドラは、通垞HTML芁玠によっおサポヌトされる同じ名前をも぀汎甚むベントハンドラに取っお代わる。

したがっお、たずえば、Documentのbody芁玠の子で送出されたわき出るerrorむベントは、芁玠のonerrorむベントハンドラコンテンツ属性を最初にもたらし、それからルヌトhtml芁玠のむベントハンドラコンテンツ属性、その埌にbody芁玠のonerrorむベントハンドラコンテンツ属性をもたらすだろう。これは、むベントがタヌゲットから、body、html、Document、Window、およびbodyでないWindowを芋おいるbody䞊のむベントハンドラぞわき出るためである。しかし、むベントがbodyを通しおわき出し、か぀むベントがWindowオブゞェクトに到達しない堎合、addEventListener()を䜿甚するbodyに属する通垞のむベントリスナヌが実行されるだろう。

このペヌゞは、ナヌザヌがオンラむンであるかどうかを衚瀺するむンゞケヌタヌを曎新する

<!DOCTYPE HTML>
<html>
 <head>
  <title>Online or offline?</title>
  <script>
   function update(online) {
     document.getElementById('status').textContent =
       online ? 'Online' : 'Offline';
   }
  </script>
 </head>
 <body ononline="update(true)"
       onoffline="update(false)"
       onload="update(navigator.onLine)">
  <p>You are: <span id="status">(Unknown)</span></p>
 </body>
</html>

4.3.2 article芁玠

カテゎリ
フロヌコンテンツ、ただしmain芁玠を子孫にもたない。
セクショニングコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
article デフォルト - 蚭定しない、 application、documentたたはmain。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

article芁玠は、文曞、ペヌゞ、アプリケヌション、たたはサむトの䞭で完党もしくは自己完結した構造を衚す。これは原則ずしお、たずえばシンゞケヌションなど、独立しお配垃可胜なたたは再利甚可胜なものである。これは、フォヌラムの投皿、雑誌や新聞の蚘事、ブログの゚ントリ、ナヌザヌの投皿コメント、むンタラクティブなりィゞェットやガゞェット、たたはコンテンツの任意の独立した項目であるかもしれない。

article芁玠がネストされる堎合、原則的に内偎のarticle芁玠が倖偎の蚘事の内容に関連する蚘事を衚す。たずえば、ナヌザヌの投皿コメントを受け付けるサむトのブログ゚ントリは、ブログ゚ントリのarticle芁玠内にネストされたarticle芁玠ずしおコメントを衚すこずができる。

article芁玠に関連付けられおいる著者の情報address芁玠を参照のこずは、ネストされたarticle芁玠には適甚されない。

シンゞケヌションで再配垃されるコンテンツずずもに明確に䜿甚された堎合、article芁玠は、Atomでのentry芁玠の目的ず類䌌性がある。[ATOM]

ペヌゞの䞻芁コンテンツすなわちフッタヌ、ヘッダヌ、ナビゲヌションブロック、およびサむドバヌを陀くが、すべお単䞀の自己完結型の構成物である堎合、コンテンツはmain芁玠でマヌクアップされるべきであり、か぀コンテンツはたたarticleでマヌクアップされおもよいが、単䞀の文曞であるように、ペヌゞが単䞀の構成物であるこずは自明なのでこの堎合は技術的に冗長である。

この䟋は、schema.org泚釈をも぀article芁玠を䜿甚するブログ蚘事を瀺す。

<article itemscope itemtype="http://schema.org/BlogPosting">
 <header>
  <h1 itemprop="headline">The Very First Rule of Life</h1>
  <p><time itemprop="datePublished" datetime="2009-10-09">3 days ago</time></p>
  <link itemprop="url" href="?comments=0">
 </header>
 <p>If there's a microphone anywhere near you, assume it's hot and
 sending whatever you're saying to the world. Seriously.</p>
 <p>...</p>
 <footer>
  <a itemprop="discussionUrl" href="?comments=1">Show comments...</a>
 </footer>
</article>

これは同じブログの蚘事であるが、コメントの䞀郚を瀺す

<article itemscope itemtype="http://schema.org/BlogPosting">
 <header>
  <h1 itemprop="headline">The Very First Rule of Life</h1>
  <p><time itemprop="datePublished" datetime="2009-10-09">3 days ago</time></p>
  <link itemprop="url" href="?comments=0">
 </header>
 <p>If there's a microphone anywhere near you, assume it's hot and
 sending whatever you're saying to the world. Seriously.</p>
 <p>...</p>
 <section>
  <h1>Comments</h1>
  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
   <link itemprop="url" href="#c1">
   <footer>
    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
     <span itemprop="name">George Washington</span>
    </span></p>
    <p><time itemprop="commentTime" datetime="2009-10-10">15 minutes ago</time></p>
   </footer>
   <p>Yeah! Especially when talking about your lobbyist friends!</p>
  </article>
  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
   <link itemprop="url" href="#c2">
   <footer>
    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
     <span itemprop="name">George Hammond</span>
    </span></p>
    <p><time itemprop="commentTime" datetime="2009-10-10">5 minutes ago</time></p>
   </footer>
   <p>Hey, you have the same first name as me.</p>
  </article>
 </section>
</article>

たずえば、誰がい぀曞いたかなど各コメントに察しお情報を䞎えるためのfooterの甚法に泚意するこず。たずえばこの堎合のように、footer芁玠は、適切な堎合にそのセクションの先頭に衚瀺するこずができる。この堎合、headerの䜿甚は、どちらも間違っおいないだろう。これは䞻にオヌサリングの奜みの問題である。

4.3.3 section芁玠

カテゎリ
フロヌコンテンツ。
セクショニングコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
regionロヌル デフォルト - 蚭定しない、 alert、alertdialog、application、contentinfo、dialog、document、log、main、marquee、presentation、searchたたはstatus。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

section芁玠は、文曞たたはアプリケヌションの䞀般的セクションを衚す。この文脈においおセクションは、䞻題を衚すコンテンツのグルヌプである。各sectionの䞻題は、section芁玠の子ずしお芋出しh1-h6芁玠を含むこずによっお䞀般に識別されるべきである。

セクションの䟋は、章、タブ付きのダむアログボックス内のさたざたなタブ付きペヌゞ、たたは論文の番号付きセクションであろう。りェブサむトのホヌムペヌゞは、はしがき、ニュヌス、および連絡先情報のセクションに分けるこずができるだろう。

芁玠のコンテンツを配絊するこずが理にかなう堎合、著者はsection芁玠の代わりにarticle芁玠を䜿甚するよう掚奚される。

section芁玠は包括的なコンテナ芁玠ではない。芁玠がスタむル付け目的たたはスクリプティングの䟿宜のために必芁になった堎合のみ、著者は、代わりにdiv芁玠を䜿甚するよう掚奚される。芁玠の内容が文曞のアりトラむンで明瀺的に蚘茉されるだろう堎合のみ、section芁玠が適切であるずいうのが䞀般的なルヌルである。

次の䟋においお、2぀の短いセクションを含む、リンゎに぀いお倧芏暡なりェブペヌゞの䞀郚の蚘事を芋おみる。

<article>
 <header>
  <h2>Apples</h2>
  <p>Tasty, delicious fruit!</p>
 </header>
 <p>The apple is the pomaceous fruit of the apple tree.</p>
 <section>
  <h3>Red Delicious</h3>
  <p>These bright red apples are the most common found in many
  supermarkets.</p>
 </section>
 <section>
  <h3>Granny Smith</h3>
  <p>These juicy, green apples make a great filling for
  apple pies.</p>
 </section>
</article>

これは、2぀のセクションをも぀卒業匏のプログラムであり、1぀は卒業する人のリスト、もう1぀は匏の説明である。この䟋においおマヌクアップは、芁玠間の空癜の量を最小化するために䜿甚される珍しいスタむルを特城ずする。

<!DOCTYPE Html>
<Html
 ><Head
   ><Title
     >Graduation Ceremony Summer 2022</Title
   ></Head
 ><Body
   ><H1
     >Graduation</H1
   ><Section
     ><H2
       >Ceremony</H2
     ><P
       >Opening Procession</P
     ><P
       >Speech by Validactorian</P
     ><P
       >Speech by Class President</P
     ><P
       >Presentation of Diplomas</P
     ><P
       >Closing Speech by Headmaster</P
   ></Section
   ><Section
     ><H2
       >Graduates</H2
     ><Ul
       ><Li
         >Molly Carpenter</Li
       ><Li
         >Anastasia Luccio</Li
       ><Li
         >Ebenezar McCoy</Li
       ><Li
         >Karrin Murphy</Li
       ><Li
         >Thomas Raith</Li
       ><Li
         >Susan Rodriguez</Li
     ></Ul
   ></Section
 ></Body
></Html>

この䟋においお、本の著者は、章ず付録のようないく぀かのセクションをマヌクアップし、異なるセクションの2぀のクラスでヘッダヌをスタむル付けするためにCSSを䜿甚しおいる。党䜓の本は、他の本を含むより倧きな文曞の䞀郚ずしおarticle芁玠に包たれる。

<article class="book">
 <style>
  section { border: double medium; margin: 2em; }
  section.chapter h1 { font: 2em Roboto, Helvetica Neue, sans-serif; }
  section.appendix h1 { font: small-caps 2em Roboto, Helvetica Neue, sans-serif; }
 </style>
 <header>
   <h2>My Book</h2>
   <p>A sample with not much content</p>
  <p><small>Published by Dummy Publicorp Ltd.</small></p>
 </header>
  
 <section class="chapter">
  <h3>My First Chapter</h3>
  <p>This is the first of my chapters. It doesn't say much.</p>
  <p>But it has two paragraphs!</p>
 </section>
 <section class="chapter">
  <h3>It Continutes: The Second Chapter</h3>
  <p>Bla dee bla, dee bla dee bla. Boom.</p>
 </section>
 <section class="chapter">
  <h3>Chapter Three: A Further Example</h3>
  <p>It's not like a battle between brightness and earthtones would go
  unnoticed.</p>
  <p>But it might ruin my story.</p>
 </section>
 <section class="appendix">
  <h3>Appendix A: Overview of Examples</h3>
  <p>These are demonstrations.</p>
 </section>
 <section class="appendix">
  <h3>Appendix B: Some Closing Remarks</h3>
  <p>Hopefully this long example shows that you <em>can</em> style
  sections, so long as they are used to indicate actual sections.</p>
 </section>
</article>

4.3.4 nav芁玠

カテゎリ
フロヌコンテンツ。
セクショニングコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ、ただしmain芁玠を子孫にもたない。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
navigationロヌルデフォルト - 蚭定しないたたはpresentation。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

nav芁玠は、他のペヌゞぞたたはペヌゞ内の䞀郚ぞリンクするペヌゞのセクション、すなわちナビゲヌションリンクをも぀セクションを衚す。

nav芁玠のコンテンツが項目のリストを衚す堎合、理解ずナビゲヌションを支揎するために、リストのマヌクアップを䜿甚する。

ペヌゞ䞊のリンクのグルヌプがnav芁玠である必芁はない―この芁玠は、䞻芁なナビゲヌションブロックから成るセクションを䞻に察象ずしおいる。特に、サヌビスの条件、ホヌムペヌゞ、著䜜暩ペヌゞのような、サむトのさたざたなペヌゞぞの簡朔なリンクのリストをフッタヌが持぀こずは、䞀般的である。footer芁玠は単独で、このような堎合に察しお十分である。䞀方nav芁玠は、そのような堎合に䜿甚できるが、通垞䞍芁である。

初期のレンダリングで省略されおいるナビゲヌション情報から利益を埗るこずができる、たたはすぐに利甚可胜であるナビゲヌション情報から利益を埗るこずができるナヌザヌを察象ずするスクリヌンリヌダヌなどのナヌザヌ゚ヌゞェントは、ペヌゞ䞊のどのコンテンツに最初にスキップたたは芁求もしくはその䞡方に応じお提䟛するかを決定する方法ずしお、この芁玠を䜿甚できる。

次の䟋においお、ペヌゞはリンクが存圚する耇数の堎所を持぀が、そのうちの1぀のみがナビゲヌションセクションずみなされる。

<body itemscope itemtype="http://schema.org/Blog">
 <header>
  <h1>Wake up sheeple!</h1>
  <p><a href="news.html">News</a> -
     <a href="blog.html">Blog</a> -
     <a href="forums.html">Forums</a></p>
  <p>Last Modified: <span itemprop="dateModified">2009-04-01</span></p>
  <nav>
   <h1>Navigation</h1>
   <ul>
    <li><a href="articles.html">Index of all articles</a></li>
    <li><a href="today.html">Things sheeple need to wake up for today</a></li>
    <li><a href="successes.html">Sheeple we have managed to wake</a></li>
   </ul>
  </nav>
 </header>
 <main>
  <article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
   <header>
    <h1 itemprop="headline">My Day at the Beach</h1>
   </header>
   <div itemprop="articleBody">
    <p>Today I went to the beach and had a lot of fun.</p>
    ...more content...
   </div>
   <footer>
    <p>Posted <time itemprop="datePublished" datetime="2009-10-10">Thursday</time>.</p>
   </footer>
  </article>
  ...more blog posts...
 </main>
 <footer>
  <p>Copyright ©
   <span itemprop="copyrightYear">2010</span>
   <span itemprop="copyrightHolder">The Example Company</span>
  </p>
  <p><a href="about.html">About</a> -
     <a href="policy.html">Privacy Policy</a> -
     <a href="contact.html">Contact Us</a></p>
 </footer>
</body>

ペヌゞの䞻芁コンテンツを包むために䜿甚されおいるmain芁玠に泚目する。この堎合、ペヌゞヘッダヌずフッタヌ以倖の党おのコンテンツずなる。

ブログの蚘事に぀いお、公開日およびその他のメタデヌタを提䟛するためにschema.orgの語圙を䜿甚する䞊蚘の䟋で、マむクロデヌタの泚釈も芋るこずができる。

次の䟋においお、2぀のnav芁玠がある。1぀はサむト呚蟺の䞻芁なナビゲヌションのため、もう1぀はペヌゞ自身呚蟺の補助的なナビゲヌション甚である。

<body>
 <h1>The Wiki Center Of Exampland</h1>
 <nav>
  <ul>
   <li><a href="/">Home</a></li>
   <li><a href="/events">Current Events</a></li>
   ...more...
  </ul>
 </nav>
 <main>
  <header>
   <h1>Demos in Exampland</h1>
   <p>Written by A. N. Other.</p>
  </header>
  <nav>
   <ul>
    <li><a href="#public">Public demonstrations</a></li>
    <li><a href="#destroy">Demolitions</a></li>
    ...more...
   </ul>
  </nav>
  <div>
   <section id="public">
    <h1>Public demonstrations</h1>
    <p>...more...</p>
   </section>
   <section id="destroy">
    <h1>Demolitions</h1>
    <p>...more...</p>
   </section>
   ...more...
  </div>
  <footer>
   <p><a href="?edit">Edit</a> | <a href="?delete">Delete</a> | <a href="?Rename">Rename</a></p>
  </footer>
 </main>
 <footer>
  <p><small>© copyright 1998 Exampland Emperor</small></p>
 </footer>
</body>

nav芁玠はリストを含める必芁はなく、同様に他の皮類のコンテンツを含むこずができる。このナビゲヌションブロックにおいお、リンクは文で提䟛されおいる

<nav>
 <h1>Navigation</h1>
 <p>You are on my home page. To the north lies <a href="/blog">my
 blog</a>, from whence the sounds of battle can be heard. To the east
 you can see a large mountain, upon which many <a
 href="/school">school papers</a> are littered. Far up thus mountain
 you can spy a little figure who appears to be me, desperately
 scribbling a <a href="/school/thesis">thesis</a>.</p>
 <p>To the west are several exits. One fun-looking exit is labeled <a
 href="http://games.example.com/">"games"</a>. Another more
 boring-looking exit is labeled <a
 href="http://isp.example.net/">ISP™</a>.</p>
 <p>To the south lies a dark and dank <a href="/about">contacts
 page</a>. Cobwebs cover its disused entrance, and at one point you
 see a rat run quickly out of the page.</p>
</nav>

4.3.5 aside芁玠

カテゎリ
フロヌコンテンツ。
セクショニングコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ、ただしmain芁玠を子孫にもたない。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
complementaryロヌルデフォルト - 蚭定しない、note、searchたたはpresentation。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

aside芁玠は、aside芁玠の呚りにコンテンツずわずかに関連し、か぀そのコンテンツから分離するず芋なすこずができるコンテンツで構成されるペヌゞのセクションを衚す。このようなセクションは、しばしば掻版印刷でサむドバヌずしお衚瀺される。

この芁玠はリヌド文たたはサむドバヌのような印刷䞊の効果に察しお、navの芁玠のグルヌプに察しお、広告に察しお、およびそのペヌゞのメむンコンテンツずは別に考えられる他のコンテンツに察しお䜿甚できる。

これらの文曞はメむンフロヌの䞀郚であるので、単に挿入句にaside芁玠を䜿甚するこずは適切でない。

次の䟋は、asideがペヌロッパのかなり長いニュヌス蚘事でスむスの背景玠材をマヌクアップに察しお䜿甚される様子を瀺す。

<aside>
 <h1>Switzerland</h1>
 <p>Switzerland, a land-locked country in the middle of geographic
 Europe, has not joined the geopolitical European Union, though it is
 a signatory to a number of European treaties.</p>
</aside>

次の䟋は、asideが長い蚘事でリヌド文のマヌクアップに察しお䜿甚される様子を瀺す。

...

<p>He later joined a large company, continuing on the same work.
<q>I love my job. People ask me what I do for fun when I'm not at
work. But I'm paid to do my hobby, so I never know what to
answer. Some people wonder what they would do if they didn't have to
work... but I know what I would do, because I was unemployed for a
year, and I filled that time doing exactly what I do now.</q></p>

<aside>
 <q> People ask me what I do for fun when I'm not at work. But I'm
 paid to do my hobby, so I never know what to answer. </q>
</aside>

<p>Of course his work — or should that be hobby? —
isn't his only passion. He also enjoys other pleasures.</p>

...

以䞋は、ブログロヌル他のブログぞのリンクずブログの反察偎のコンテンツにasideが䜿甚される様子を瀺す。

<body>
 <header>
  <h1>My wonderful blog</h1>
  <p>My tagline</p>
 </header>
 <aside>
  <!-- this aside contains two sections that are tangentially related
  to the page, namely, links to other blogs, and links to blog posts
  from this blog -->
  <nav>
   <h1>My blogroll</h1>
   <ul>
    <li><a href="http://blog.example.com/">Example Blog</a>
   </ul>
  </nav>
  <nav>
   <h1>Archives</h1>
   <ol reversed>
    <li><a href="/last-post">My last post</a>
    <li><a href="/first-post">My first post</a>
   </ol>
  </nav>
 </aside>
 <aside>
  <!-- this aside is tangentially related to the page also, it
  contains twitter messages from the blog author -->
  <h1>Twitter Feed</h1>
  <blockquote cite="http://twitter.example.net/t31351234">
   I'm on vacation, writing my blog.
  </blockquote>
  <blockquote cite="http://twitter.example.net/t31219752">
   I'm going to go on vacation soon.
  </blockquote>
 </aside>
 <article>
  <!-- this is a blog post -->
  <h1>My last post</h1>
  <p>This is my last post.</p>
  <footer>
   <p><a href="/last-post" rel=bookmark>Permalink</a>
  </footer>
 </article>
 <article>
  <!-- this is also a blog post -->
  <h1>My first post</h1>
  <p>This is my first post.</p>
  <aside>
   <!-- this aside is about the blog post, since it's inside the
   <article> element; it would be wrong, for instance, to put the
   blogroll here, since the blogroll isn't really related to this post
   specifically, only to the page as a whole -->
   <h1>Posting</h1>
   <p>While I'm thinking about it, I wanted to say something about
   posting. Posting is fun!</p>
  </aside>
  <footer>
   <p><a href="/first-post" rel=bookmark>Permalink</a>
  </footer>
 </article>
 <footer>
  <nav>
   <a href="/archives">Archives</a> —
   <a href="/about">About me</a> —
   <a href="/copyright">Copyright</a>
  </nav>
 </footer>
</body>

4.3.6 h1、h2、h3、h4、h5、h6芁玠

カテゎリ
フロヌコンテンツ。
ヘディングコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フレヌゞングコンテンツ。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
headingロヌルデフォルト - 蚭定しない、tabたたはpresentation。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
interface HTMLHeadingElement : HTMLElement {};

これらの芁玠は、そのセクションの芋出しを衚す。

セマンティックずこれらの芁玠の意味は芋出しずセクションの節で定矩される。

これらの芁玠は、芁玠名の数字で䞎えられたランクを持぀。h1芁玠が最も高いランクを持぀ず蚀われ、h6芁玠が最も䜎いランクを持ち、同じ名前をも぀2぀の芁玠は等しいランクを持぀。

新しいセクションたたはサブセクションの芋出しであるこずを意図する堎合を陀き、小芋出し、字幕、代替タむトルやキャッチフレヌズをマヌクアップするためにh1–h6芁玠を䜿甚しおはならない。代わりに、仕様の専甚芁玠なしで共通むディオムの節におけるマヌクアップパタヌンを䜿甚する。

それぞれの文曞のアりトラむンその芋出しずセクションの構造が関係する限りにおいお、次の2぀の断片は、セマンティックに等䟡である

<body>
<h1>Let's call it a draw(ing surface)</h1>
<h2>Diving in</h2>
<h2>Simple shapes</h2>
<h2>Canvas coordinates</h2>
<h3>Canvas coordinates diagram</h3>
<h2>Paths</h2>
</body>
<body>
 <h1>Let's call it a draw(ing surface)</h1>
 <section>
  <h1>Diving in</h1>
 </section>
 <section>
  <h1>Simple shapes</h1>
 </section>
 <section>
  <h1>Canvas coordinates</h1>
  <section>
   <h1>Canvas coordinates diagram</h1>
  </section>
 </section>
 <section>
  <h1>Paths</h1>
 </section>
</body>

著者は、その簡朔さのために前者のスタむルを奜むかもしれないし、倧量の線集を目の前にしお利䟿性のために埌者のスタむルを奜むかもしれない。どちらが玔粋に最良なのかは、オヌサリングスタむルの奜みの問題である。

4.3.7 header芁玠

カテゎリ
フロヌコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ、ただしheader、footer、たたはmain芁玠の子孫を陀く。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
bannerロヌルデフォルト - 蚭定しないたたはpresentation。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

header芁玠は、その盎近の祖先セクショニングコンテンツたたはセクショニングルヌト芁玠に察するヘッダヌを衚す。headerは芁玠は兞型的に、前眮きたたはナビゲヌション補助のグルヌプを含む。

最も近い祖先セクショニングコンテンツたたはセクショニングルヌト芁玠がbody芁玠である堎合、これはペヌゞ党䜓に適甚される。

header芁玠は、通垞、セクションの芋出しh1–h6芁玠を含むように意図されるが、これは必須ではない。header芁玠はたた、セクションのコンテンツの目録、怜玢フォヌム、たたは関連するロゎを包むために䜿甚できる。

サンプルheaderは以䞋のずおり。この最初のものは、ゲヌムのために存圚する

<header>
 <p>Welcome to...</p>
 <h1>Voidwars!</h1>
</header>

次の断片は、芁玠が仕様のヘッダヌをマヌクアップに察しお䜿甚できる様子を瀺す。

<header>
  <h1>Scalable Vector Graphics (SVG) 1.2</h1>
  <p>W3C Working Draft 27 October 2004</p>
 <dl>
  <dt>This version:</dt>
  <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/">http://www.w3.org/TR/2004/WD-SVG12-20041027/</a></dd>
  <dt>Previous version:</dt>
  <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/">http://www.w3.org/TR/2004/WD-SVG12-20040510/</a></dd>
  <dt>Latest version of SVG 1.2:</dt>
  <dd><a href="http://www.w3.org/TR/SVG12/">http://www.w3.org/TR/SVG12/</a></dd>
  <dt>Latest SVG Recommendation:</dt>
  <dd><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></dd>
  <dt>Editor:</dt>
  <dd>Dean Jackson, W3C, <a href="mailto:dean@w3.org">dean@w3.org</a></dd>
  <dt>Authors:</dt>
  <dd>See <a href="#authors">Author List</a></dd>
 </dl>
 <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notic ...
</header>

header芁玠は、セクショニングコンテンツではない。新しいセクションを導入しない。

この䟋は、ペヌゞがh1芁玠で䞎えられたペヌゞ芋出しず、h2芁玠によっお䞎えられた2぀のサブセクションを持぀。header芁玠はアりトラむンアルゎリズムに参加しないため、header芁玠の埌のコンテンツは、䟝然ずしおheader芁玠で最埌に開始したサブセクションの䞀郚である。

<body>
 <header>
  <h1>Little Green Guys With Guns</h1>
  <nav>
   <ul>
    <li><a href="/games">Games</a>
    <li><a href="/forum">Forum</a>
    <li><a href="/download">Download</a>
   </ul>
  </nav>
  <h2>Important News</h2> <!-- this starts a second subsection -->
  <!-- this is part of the subsection entitled "Important News" -->
  <p>To play today's games you will need to update your client.</p>
  <h2>Games</h2> <!-- this starts a third subsection -->
 </header>
 <p>You have three active games:</p>
 <!-- this is still part of the subsection entitled "Games" -->
 ...
カテゎリ
フロヌコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ、ただしheader、footer、たたはmain芁玠の子孫を陀く。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
contentinfoロヌルデフォルト - 蚭定しないたたはpresentation。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

footer芁玠は、その盎近の祖先セクショニングコンテンツたたはセクショニングルヌト芁玠に察するフッタヌを衚す。フッタヌは、たずえば誰が曞いたか、関連文曞ぞのリンク、著䜜暩デヌタなど、そのセクション関する情報を䞀般に含む。

footer芁玠がセクション党䜓を含む堎合、付録、玢匕、長い奥付、冗長なラむセンス契玄などのコンテンツを衚す。

セクションの著者や線集者に察する連絡先情報は、おそらくfooter内偎にそれ自身、address芁玠に属する。headerやfooterの䞡方に適するだろう眲名欄およびその他の情報は、いずれかたたはどちらでもないに配眮できる。これらの芁玠の䞻な目的は、著者が維持し、スタむルが容易である自明のマヌクアップを曞くためだけである。これら芁玠は著者に特定の構造を課すこずを意図するものではない。

フッタヌは必ずしも、セクションの最埌に出珟する必芁はない通垞は最埌だが。

最も近い祖先セクショニングコンテンツたたはセクショニングルヌト芁玠がbody芁玠である堎合、これはペヌゞ党䜓に適甚される。

footer芁玠は、セクショニングコンテンツではない。新しいセクションを導入しない。

これは、䞀番䞊ず䞀番䞋に2぀のフッタヌを持぀、同じコンテンツのペヌゞである

<body>
 <footer><a href="../">Back to index...</a></footer>
 <div>
  <h1>Lorem ipsum</h1>
  <p>The ipsum of all lorems</p>
 </div>
 <p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
 veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
 ea commodo consequat. Duis aute irure dolor in reprehenderit in
 voluptate velit esse cillum dolore eu fugiat nulla
 pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
 culpa qui officia deserunt mollit anim id est laborum.</p>
 <footer><a href="../">Back to index...</a></footer>
</body>

これは、サむト党䜓のフッタヌずセクションフッタヌの䞡方に䜿甚されおいるfooter芁玠を瀺す䟋である。

<!DOCTYPE HTML>
<HTML><HEAD>
<TITLE>The Ramblings of a Scientist</TITLE>
<BODY>
<H1>The Ramblings of a Scientist</H1>
<MAIN>
 <ARTICLE>
 <H1>Episode 15</H1>
 <VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD>
  <P><A HREF="/fm/015.ogv">Download video</A>.</P>
 </VIDEO>
 <FOOTER> <!-- footer for article -->
  <P>Published <TIME DATETIME="2009-10-21T18:26-07:00">on 2009/10/21 at 6:26pm</TIME></P>
 </FOOTER>
</ARTICLE>
<ARTICLE>
 <H1>My Favorite Trains</H1>
 <P>I love my trains. My favorite train of all time is a Köf.</P>
 <P>It is fun to see them pull some coal cars because they look so
 dwarfed in comparison.</P>
 <FOOTER> <!-- footer for article -->
  <P>Published <TIME DATETIME="2009-09-15T14:54-07:00">on 2009/09/15 at 2:54pm</TIME></P>
 </FOOTER>
 </ARTICLE>
</MAIN>
<FOOTER> <!-- site wide footer -->
 <NAV>
  <P><A HREF="/credits.html">Credits</A> —
     <A HREF="/tos.html">Terms of Service</A> —
     <A HREF="/index.html">Blog Index</A></P>
 </NAV>
 <P>Copyright © 2009 Gordon Freeman</P>
</FOOTER>
</BODY>
</HTML>

䞀郚のサむトのデザむンは、時々"分厚いフッタヌ"ず呌ばれるものを持぀―フッタヌは、画像、他の蚘事ぞのリンク、フィヌドバック送信甚ペヌゞぞのリンク、特別オファヌなど、いく぀かの点で、フッタヌで党䜓の"フロントペヌゞ"ずもいえる倧量の玠材を含む。

この断片は、"分厚いフッタヌ"をも぀サむト䞊でペヌゞの最䞋郚を瀺す

...
 <footer>
  <nav>
   <section>
    <h1>Articles</h1>
    <p><img src="images/somersaults.jpeg" alt=""> Go to the gym with
    our somersaults class! Our teacher Jim takes you through the paces
    in this two-part article. <a href="articles/somersaults/1">Part
    1</a> · <a href="articles/somersaults/2">Part 2</a></p>
    <p><img src="images/kindplus.jpeg"> Tired of walking on the edge of
    a clif<!-- sic -->? Our guest writer Lara shows you how to bumble
    your way through the bars. <a href="articles/kindplus/1">Read
    more...</a></p>
    <p><img src="images/crisps.jpeg"> The chips are down, now all
    that's left is a potato. What can you do with it? <a
    href="articles/crisps/1">Read more...</a></p>
   </section>
   <ul>
    <li> <a href="/about">About us...</a>
    <li> <a href="/feedback">Send feedback!</a>
    <li> <a href="/sitemap">Sitemap</a>
   </ul>
  </nav>
  <p><small>Copyright © 2015 The Snacker —
  <a href="/tos">Terms of Service</a></small></p>
 </footer>
</body>

4.3.9 address芁玠

カテゎリ
フロヌコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
フロヌコンテンツ、ただしヘディングコンテンツの子孫、セクショニングコンテンツの子孫、およびheader、footer、address芁玠の子孫を陀く。
コンテンツ属性
グロヌバル属性
text/htmlにおけるタグ省略
どちらのタグも省略䞍可
蚱可されるARIAロヌル属性倀
contentinfoロヌル。
蚱可されるARIAステヌトおよびプロパティヌ
グロヌバルaria-* 属性
蚱可されるロヌルで受け入れ可胜な任意のaria-*属性。
DOMむンタヌフェヌス
HTMLElementを䜿甚する。

address芁玠は、最も近いarticleたたはbody芁玠の祖先の連絡先情報を衚す。祖先がbody芁玠である堎合、連絡先情報は、文曞党䜓に適甚される。

たずえば、HTMLに関連するW3Cのりェブサむトにあるペヌゞは、以䞋の連絡先情報を含むかもしれない

<ADDRESS>
 <A href="../People/Raggett/">Dave Raggett</A>,
 <A href="../People/Arnaud/">Arnaud Le Hors</A>,
 contact persons for the <A href="Activity">W3C HTML Activity</A>
</ADDRESS>

アドレスが実際に関連する連絡先情報でない堎合、address芁玠は、任意のアドレスたずえば郵䟿の宛先を衚すために䜿甚しおはならない。p芁玠は、䞀般に䜏所をマヌクアップするための適切な芁玠である。

address芁玠は連絡先情報以倖の情報を含んではならない。

たずえば、次の䟋はaddress芁玠の䞍適合な甚法である

<ADDRESS>Last Modified: 1999/12/24 23:37:50</ADDRESS>

䞀般に、address芁玠は、footer芁玠で他の情報ず䞀緒に含たれるだろう。

The contact information for a node node is a collection of address elements defined by the first applicable entry from the following list:

If node is an article element
If node is a body element

The contact information consists of all the address elements that have node as an ancestor and do not have another body or article element ancestor that is a descendant of node.

If node has an ancestor element that is an article element
If node has an ancestor element that is a body element

The contact information of node is the same as the contact information of the nearest article or body element ancestor, whichever is nearest.

If node's Document has a body element

The contact information of node is the same as the contact information of the body element of the Document.

そうでなければ

There is no contact information for node.

User agents may expose the contact information of a node to the user, or use it for other purposes, such as indexing sections based on the sections' contact information.

この䟋においお、フッタヌは、連絡先情報および著䜜暩情報を含む。

<footer>
 <address>
  For more details, contact
  <a href="mailto:js@example.com">John Smith</a>.
 </address>
 <p><small>© copyright 2038 Example Corp.</small></p>
</footer>

4.3.10 芋出しずセクション

h1–h6芁玠は芋出しである。

セクショニングコンテンツの芁玠においおヘディングコンテンツの最初の芁玠は、そのセクションの芋出しを衚す。同等以䞊のランクに属する埌続の芋出しは、新しい暗黙のセクションを開始し、䜎いランクの芋出しは、前のセクションの䞀郚である暗黙のサブセクションを開始する。どちらの堎合も、芁玠は暗黙のセクションの芋出しを衚す。

新しいセクションたたはサブセクションの芋出しであるこずを意図する堎合を陀き、小芋出し、字幕、代替タむトルやキャッチフレヌズをマヌクアップするためにh1–h6芁玠を䜿甚しおはならない。代わりに、仕様の専甚芁玠なしで共通むディオムの節におけるマヌクアップパタヌンを䜿甚する。

blockquote芁玠ずtd芁玠を含む特定の芁玠は、セクショニングルヌトであるず蚀われおいる。これらの芁玠は、自分のアりトラむンを持぀こずができるが、芁玠の内偎のセクションず芋出しは祖先のアりトラむンに寄䞎しない。

セクショニングコンテンツ芁玠は、他の芋出しが䜜成する暗黙のセクションであるかに関わらず、最も近い祖先セクショニングルヌトたたは最も近いセクショニングコンテンツの祖先芁玠の、最も近い方のサブセクションず垞にみなされる。

次の断片の堎合

<body>
 <h1>Foo</h1>
 <h2>Bar</h2>
 <blockquote>
  <h3>Bla</h3>
 </blockquote>
 <p>Baz</p>
 <h2>Quux</h2>
 <section>
  <h3>Thud</h3>
 </section>
 <p>Grunt</p>
</body>

構造は次のようになる

  1. Foo  "Grunt"段萜を含む、明瀺的なbodyセクションの芋出し
    1. Bar匕甚ブロックず"Baz"段萜を含む、暗黙のセクションを開始する芋出し
    2. Quux その芋出し自身のみのコンテンツをも぀暗黙のセクションを開始する芋出し
    3. Thud 明瀺的なsectionセクションの芋出し

埌の段萜"Grunt"がトップレベルに戻るように、sectionがそれ以前の暗黙のセクションを終了する様子に泚目する。

セクションは、任意のランクの芋出しを含んでもよく、か぀著者はセクションのネストレベルに適切なランクの芋出しを䜿甚するよう匷く掚奚される。

著者はたた、セクショニングコンテンツの1぀の芁玠に耇数の芋出しを持぀こずによっお生成される暗黙のセクションに頌る代わりに、セクショニングコンテンツの芁玠内のセクションを明瀺的に包むこずを掚奚される。

たずえば、以䞋は正しい

<body>
 <h4>Apples</h4>
 <p>Apples are fruit.</p>
 <section>
  <h2>Taste</h2>
  <p>They taste lovely.</p>
  <h6>Sweet</h6>
  <p>Red apples are sweeter than green ones.</p>
  <h1>Color</h1>
  <p>Apples come in various colors.</p>
 </section>
</body>

ただし、同じ文曞をより明確に衚珟できるだろう。

<body>
 <h1>Apples</h1>
 <p>Apples are fruit.</p>
 <section>
  <h2>Taste</h2>
  <p>They taste lovely.</p>
  <section>
   <h3>Sweet</h3>
   <p>Red apples are sweeter than green ones.</p>
  </section>
 </section>
 <section>
  <h2>Color</h2>
  <p>Apples come in various colors.</p>
 </section>
</body>

䞊蚘の文曞の䞡方は、セマンティックに同じであり、適合ナヌザヌ゚ヌゞェントで同じアりトラむンを生成する。

この3番目の䟋はたた、セマンティックに同じであり、たずえば、セクションが線集で移動される堎合より簡単にメンテナンスできるかもしれない

<body>
 <h1>Apples</h1>
 <p>Apples are fruit.</p>
 <section>
  <h1>Taste</h1>
  <p>They taste lovely.</p>
  <section>
   <h1>Sweet</h1>
   <p>Red apples are sweeter than green ones.</p>
  </section>
 </section>
 <section>
  <h1>Color</h1>
  <p>Apples come in various colors.</p>
 </section>
</body>

この最埌の䟋は、レガシヌブラりザでレンダリングされるように明瀺的なスタむル芏則が必芁になるだろう。CSSのサポヌトなしでレガシヌブラりザは、トップレベルの芋出しずしお、すべおの芋出しをレンダリングするだろう。

4.3.10.1 アりトラむンの䜜成

アルゎリズムが適合性チェッカヌのような他の゜フトりェアに実装されるが、グラフィカルブラりザや支揎技術のナヌザ゚ヌゞェントにおけるアりトラむンアルゎリズムの既知の実装は、珟圚存圚しない。したがっおアりトラむンアルゎリズムは、ナヌザヌに文曞の構造を䌝えるために䟝存するこずができない。著者は、文曞構造を䌝えるために芋出しのランクh1-h6を䜿甚するよう勧める。

This section defines an algorithm for creating an outline for a sectioning content element or a sectioning root element. It is defined in terms of a walk over the nodes of a DOM tree, in tree order, with each node being visited when it is entered and when it is exited during the walk.

セクショニングコンテンツ芁玠たたはセクショニングルヌト芁玠に察するアりトラむンは、1぀以䞊の朜圚的にネストされたセクションのリストで構成される。セクションは、元のDOMツリヌで䞀郚のノヌドに察応するコンテナである。各セクションは、セクションに関連付けられた1぀の芋出しを持぀こずができ、さらにネストされた任意の数のセクションを含むこずができる。The algorithm for the outline also associates each node in the DOM tree with a particular section and potentially a heading. (The sections in the outline aren't section elements, though some may correspond to such elements — they are merely conceptual sections.)

次のマヌクアップ断片で

<body>
 <h1>A</h1>
 <p>B</p>
 <h2>C</h2>
 <p>D</p>
 <h2>E</h2>
 <p>F</p>
</body>

これはbodyノヌドそしお、党䜓の文曞に察しお䜜成されおいる以䞋のアりトラむンをもたらす

  1. セクションは、bodyノヌドに察しお䜜成される。

    芋出し"A"を関連付けられおいる。

    たた、段萜"B"を関連付けられおいる。

    ネストされたセクション

    1. セクションは1番目のh2芁玠を瀺唆する。

      芋出し"C"を関連付けられおいる。

      たた、段萜"D"を関連付けられおいる。

      ネストされたセクションはない。

    2. セクションは2番目のh2芁玠を瀺唆する。

      芋出し"E"を関連付けられおいる。

      たた、段萜"F"を関連付けられおいる。

      ネストされたセクションはない。

The algorithm that must be followed during a walk of a DOM subtree rooted at a sectioning content element or a sectioning root element to determine that element's outline is as follows:

  1. Let current outline target be null. (It holds the element whose outline is being created.)

  2. Let current section be null. (It holds a pointer to a section, so that elements in the DOM can all be associated with a section.)

  3. Create a stack to hold elements, which is used to handle nesting. Initialize this stack to empty.

  4. Walk over the DOM in tree order, starting with the sectioning content element or sectioning root element at the root of the subtree for which an outline is to be created, and trigger the first relevant step below for each element as the walk enters and exits it.

    When exiting an element, if that element is the element at the top of the stack

    The element being exited is a heading content element or an element with a hidden attribute.

    Pop that element from the stack.

    If the top of the stack is a heading content element or an element with a hidden attribute

    䜕もしない。

    When entering an element with a hidden attribute

    Push the element being entered onto the stack. (This causes the algorithm to skip that element and any descendants of the element.)

    When entering a sectioning content element

    Run these steps:

    1. If current outline target is not null, run these substeps:

      1. If the current section has no heading, create an implied heading and let that be the heading for the current section.

      2. Push current outline target onto the stack.

    2. Let current outline target be the element that is being entered.

    3. Let current section be a newly created section for the current outline target element.

    4. Associate current outline target with current section.

    5. Let there be a new outline for the new current outline target, initialized with just the new current section as the only section in the outline.

    When exiting a sectioning content element, if the stack is not empty

    Run these steps:

    1. If the current section has no heading, create an implied heading and let that be the heading for the current section.

    2. Pop the top element from the stack, and let the current outline target be that element.

    3. Let current section be the last section in the outline of the current outline target element.

    4. Append the outline of the sectioning content element being exited to the current section. (This does not change which section is the last section in the outline.)

    When entering a sectioning root element

    Run these steps:

    1. If current outline target is not null, push current outline target onto the stack.

    2. Let current outline target be the element that is being entered.

    3. Let current outline target's parent section be current section.

    4. Let current section be a newly created section for the current outline target element.

    5. Let there be a new outline for the new current outline target, initialized with just the new current section as the only section in the outline.

    When exiting a sectioning root element, if the stack is not empty

    Run these steps:

    1. If the current section has no heading, create an implied heading and let that be the heading for the current section.

    2. Let current section be current outline target's parent section.

    3. Pop the top element from the stack, and let the current outline target be that element.

    When exiting a sectioning content element or a sectioning root element (when the stack is empty)

    The current outline target is the element being exited, and it is the sectioning content element or a sectioning root element at the root of the subtree for which an outline is being generated.

    If the current section has no heading, create an implied heading and let that be the heading for the current section.

    Skip to the next step in the overall set of steps. (The walk is over.)

    When entering a heading content element

    If the current section has no heading, let the element being entered be the heading for the current section.

    Otherwise, if the element being entered has a rank equal to or higher than the heading of the last section of the outline of the current outline target, or if the heading of the last section of the outline of the current outline target is an implied heading, then create a new section and append it to the outline of the current outline target element, so that this new section is the new last section of that outline. Let current section be that new section. Let the element being entered be the new heading for the current section.

    Otherwise, run these substeps:

    1. Let candidate section be current section.

    2. Heading loop: If the element being entered has a rank lower than the rank of the heading of the candidate section, then create a new section, and append it to candidate section. (This does not change which section is the last section in the outline.) Let current section be this new section. Let the element being entered be the new heading for the current section. Abort these substeps.

    3. Let new candidate section be the section that contains candidate section in the outline of current outline target.

    4. Let candidate section be new candidate section.

    5. Return to the step labeled heading loop.

    Push the element being entered onto the stack. (This causes the algorithm to skip any descendants of the element.)

    Recall that h1 has the highest rank, and h6 has the lowest rank.

    そうでなければ

    䜕もしない。

    In addition, whenever the walk exits a node, after doing the steps above, if the node is not associated with a section yet, associate the node with the section current section.

  5. Associate all nodes with the heading of the section with which they are associated, if any.

The tree of sections created by the algorithm above, or a proper subset thereof, must be used when generating document outlines, for example when generating tables of contents.

The outline created for the body element of a Document is the outline of the entire document.

When creating an interactive table of contents, entries should jump the user to the relevant sectioning content element, if the section was created for a real element in the original document, or to the relevant heading content element, if the section in the tree was generated for a heading in the above process.

Selecting the first section of the document therefore always takes the user to the top of the document, regardless of where the first heading in the body is to be found.

The outline depth of a heading content element associated with a section section is the number of sections that are ancestors of section in the outermost outline that section finds itself in when the outlines of its Document's elements are created, plus 1. The outline depth of a heading content element not associated with a section is 1.

User agents should provide default headings for sections that do not have explicit section headings.

Consider the following snippet:

<body>
 <nav>
  <p><a href="/">Home</a></p>
 </nav>
 <p>Hello world.</p>
 <aside>
  <p>My cat is cute.</p>
 </aside>
</body>

Although it contains no headings, this snippet has three sections: a document (the body) with two subsections (a nav and an aside). A user agent could present the outline as follows:

  1. Untitled document
    1. Navigation
    2. Sidebar

These default headings ("Untitled document", "Navigation", "Sidebar") are not specified by this specification, and might vary with the user's language, the page's language, the user's preferences, the user agent implementor's preferences, etc.

The following JavaScript function shows how the tree walk could be implemented. The root argument is the root of the tree to walk (either a sectioning content element or a sectioning root element), and the enter and exit arguments are callbacks that are called with the nodes as they are entered and exited. [ECMA262]

function (root, enter, exit) {
  var node = root;
  start: while (node) {
    enter(node);
    if (node.firstChild) {
      node = node.firstChild;
      continue start;
    }
    while (node) {
      exit(node);
      if (node == root) {
        node = null;
      } else if (node.nextSibling) {
        node = node.nextSibling;
        continue start;
      } else {
        node = node.parentNode;
      }
    }
  }
}
4.3.10.2 サンプルアりトラむン

この節は非芏範的である。

以䞋の文曞は、アりトラむンアルゎリズムの簡単なアプリケヌションを瀺す。最初に、非垞に短い章ずサブセクションをも぀本の文曞を以䞋に瀺す

<!DOCTYPE HTML>
<title>The Tax Book (all in one page)</title>
<h1>The Tax Book</h1>
<h2>Earning money</h2>
<p>Earning money is good.</p>
<h3>Getting a job</h3>
<p>To earn money you typically need a job.</p>
<h2>Spending money</h2>
<p>Spending is what money is mainly used for.</p>
<h3>Cheap things</h3>
<p>Buying cheap things often not cost-effective.</p>
<h3>Expensive things</h3>
<p>The most expensive thing is often not the most cost-effective either.</p>
<h2>Investing money</h2>
<p>You can lend your money to other people.</p>
<h2>Losing money</h2>
<p>If you spend money or invest money, sooner or later you will lose money.
<h3>Poor judgement</h3>
<p>Usually if you lose money it's because you made a mistake.</p>

この本は、以䞋のアりトラむンを圢成するだろう

  1. The Tax Book
    1. Earning money
      1. Getting a job
    2. Spending money
      1. Cheap things
      2. Expensive things
    3. Investing money
    4. Losing money
      1. Poor judgement

title芁玠はアりトラむンに関係しないこずに泚意する。

これは類䌌の文曞があるが、今回は同じ効果を埗るためにsection芁玠を䜿甚しおいる

<!DOCTYPE HTML>
<title>The Tax Book (all in one page)</title>
<h1>The Tax Book</h1>
<section>
 <h1>Earning money</h1>
 <p>Earning money is good.</p>
 <section>
  <h1>Getting a job</h1>
  <p>To earn money you typically need a job.</p>
 </section>
</section>
<section>
 <h1>Spending money</h1>
 <p>Spending is what money is mainly used for.</p>
 <section>
  <h1>Cheap things</h1>
  <p>Buying cheap things often not cost-effective.</p>
 </section>
 <section>
  <h1>Expensive things</h1>
  <p>The most expensive thing is often not the most cost-effective either.</p>
 </section>
</section>
<section>
 <h1>Investing money</h1>
 <p>You can lend your money to other people.</p>
</section>
<section>
 <h1>Losing money</h1>
 <p>If you spend money or invest money, sooner or later you will lose money.
 <section>
  <h1>Poor judgement</h1>
  <p>Usually if you lose money it's because you made a mistake.</p>
 </section>
</section>

この本は、同じアりトラむンを圢成するだろう

  1. The Tax Book
    1. Earning money
      1. Getting a job
    2. Spending money
      1. Cheap things
      2. Expensive things
    3. Investing money
    4. Losing money
      1. Poor judgement

文曞は、耇数のトップレベルの芋出しを含めるこずができる

<!DOCTYPE HTML>
<title>Alphabetic Fruit</title>
<h1>Apples</h1>
<p>Pomaceous.</p>
<h1>Bananas</h1>
<p>Edible.</p>
<h1>Carambola</h1>
<p>Star.</p>

これは3぀のトップレベルのセクションから構成される次のような単玔なアりトラむンを圢成するだろう

  1. Apples
  2. Bananas
  3. Carambola

事実䞊、body芁玠は3぀に分割される。

h1–h6モデルずsection/h1モデルの䞡方を混合するこずは、盎感的でない結果をもたらすかもしれない。

正確な前の䟋だがsectionに包たれた暗黙のbodyのコンテンツをも぀、以䞋の䟋を考慮しおみる

<!DOCTYPE HTML>
<title>Alphabetic Fruit</title>
<section>
 <h1>Apples</h1>
 <p>Pomaceous.</p>
 <h1>Bananas</h1>
 <p>Edible.</p>
 <h1>Carambola</h1>
 <p>Star.</p>
</section>

アりトラむンの結果は次のようになるだろう

  1. (untitled page)
    1. Apples
    2. Bananas
    3. Carambola

1぀のsection芁玠のみがあるにもかかわらず3぀のサブセクションが生じるため、この結果は盎感的でないものずしお蚘茉される。事実䞊、盎前の䟋で暗黙のbody芁玠ず同様に、sectionは3぀に分かれる。

この䟋においお、明瀺的な芋出しを持たないため、"(untitled page)"は、body芁玠に察しお暗黙的に指定される。

芋出しは、他のセクションを超えおくるこずはない。したがっお、次の䟋においお、最初のh1は、実際にペヌゞヘッダヌを蚘述するのではなく、ペヌゞの埌半のヘッダヌに぀いお説明する。

<!DOCTYPE HTML>
<title>Feathers on The Site of Encyclopedic Knowledge</title>
<section>
 <h1>A plea from our caretakers</h1>
 <p>Please, we beg of you, send help! We're stuck in the server room!</p>
</section>
<h1>Feathers</h1>
<p>Epidermal growths.</p>

アりトラむンの結果は次のようになるだろう

  1. (untitled page)
    1. A plea from our caretakers
  2. Feathers

このように、article芁玠がnavブロックで始たりか぀単に埌でその芋出しを持぀堎合、結果はnavブロックがアりトラむンで残りのarticle郚分ず同じセクションの䞀郚ではないものである。たずえば、次の文曞を取る

<!DOCTYPE HTML>
<title>We're adopting a child! — Ray's blog</title>
...

<h1>Ray's blog</h1>

<main>
 <article>
<header>
  <nav>
   <a href="?t=-1d">Yesterday</a>;
   <a href="?t=-7d">Last week</a>;
   <a href="?t=-1m">Last month</a>
  </nav> 
</header>
  <h2>We're adopting a child!</h2>

  <p>As of today, Janine and I have signed the papers to become
  the proud parents of baby Diane! We've been looking forward to
  this day for weeks.</p>
</article> 
</main>
...

アりトラむンの結果は次のようになるだろう

  1. Ray's blog
    1. Untitled article
      1. Untitled navigation section
    2. We're adopting a child!

たた、この䟋においお、headerずmain芁玠が文曞のアりトラむンに䜕ら圱響を䞎えないこずは泚目に倀する。

4.3.11 䜿甚方法の抂芁

この節は非芏範的である。

芁玠 目的
䟋
body
<!DOCTYPE HTML>
<html>
 <head> <title>Steve Hill's Home Page</title> </head>
 <body> <p>Hard Trance is My Life.</p> </body>
</html>
article
<article>
 <img src="/tumblr_masqy2s5yn1rzfqbpo1_500.jpg" alt="Yellow smiley face with the caption 'masif'">
 <p>My fave Masif tee so far!</p>
 <footer>Posted 2 days ago</footer>
</article>
<article>
 <img src="/tumblr_m9tf6wSr6W1rzfqbpo1_500.jpg" alt="">
 <p>Happy 2nd birthday Masif Saturdays!!!</p>
 <footer>Posted 3 weeks ago</footer>
</article>
section
<h1>Biography</h1>
<section>
 <h1>The facts</h1>
 <p>1500+ shows, 14+ countries</p>
</section>
<section>
 <h1>2010/2011 figures per year</h1>
 <p>100+ shows, 8+ countries</p>
</section>
nav
<nav>
 <ul>
  <li><a href="/">Home</a>
  <li><a href="/biog.html">Bio</a>
  <li><a href="/discog.html">Discog</a>
 </ul>
</nav>
aside
<h1>Music</h1>
<p>As any burner can tell you, the event has a lot of trance.</p>
<aside>You can buy the music we played at our <a href="buy.html">playlist page</a>.</aside>
<p>This year we played a kind of trance that originated in Belgium, Germany, and the Netherlands in the mid 90s.</p>
h1–h6 セクションの芋出し
<h1>The Guide To Music On The Playa</h1>
<h2>The Main Stage</h2>
<p>If you want to play on a stage, you should bring one.</p>
<h2>Amplified Music</h2>
<p>Amplifiers up to 300W or 90dB are welcome.</p>
header
<article>
 <header>
  <h1>Hard Trance is My Life</h1>
  <p>By DJ Steve Hill and Technikal</p>
 </header>
 <p>The album with the amusing punctuation has red artwork.</p>
</article>
footer
<article>
 <h1>Hard Trance is My Life</h1>
 <p>The album with the amusing punctuation has red artwork.</p>
 <footer>
  <p>Artists: DJ Steve Hill and Technikal</p>
 </footer>
</article>
4.3.11.1 Articleかsectionか

この節は非芏範的である。

sectionは、䜕か別のものの䞀郚を圢成する。articleは自分自身である。しかし、どっちがどっちか分かるだろうかたいおい真の答えは"著者の意図に䟝存する"である。

たずえば、"これはみずみずしく、青リンゎはアップルパむの玠晎らしいフィリングになる"ずだけ述べた"グラニヌスミス"の章のある本を想像しおみよう。倚分他のリンゎの皮類の章が倚数あるため、これはsectionだろう。

䞀方で、぀ぶやきやredditのコメント、Tumblrのポストや単に広告に分類される新聞を想像しおみよう。"グラニヌスミス。これはみずみずしく、青リンゎはアップルパむの玠晎らしいフィリングになる。"党郚があったので、articleだろう。

蚘事におけるコメントはコメントされおいるarticleの䞀郚ではなく、したがっおarticle自身である。