Movatterモバイル変換


[0]ホーム

URL:


  1. 開発者向けのウェブ技術
  2. HTML
  3. リファレンス
  4. 要素
  5. <figure>

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。

View in EnglishAlways switch to English

<figure>: キャプションが付けられる図要素

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

<figure>HTML の要素で、図表などの自己完結型のコンテンツを表し、任意で<figcaption> 要素を使用して表されるキャプションを付けることができます。図、すなわちキャプションとその中身は一単位として参照されます。

試してみましょう

<figure>  <img    src="/shared-assets/images/examples/elephant.jpg"    alt="Elephant at sunset" />  <figcaption>An elephant at sunset</figcaption></figure>
figure {  border: thin #c0c0c0 solid;  display: flex;  flex-flow: column;  padding: 5px;  max-width: 220px;  margin: auto;}img {  max-width: 220px;  max-height: 150px;}figcaption {  background-color: #222;  color: #fff;  font: italic smaller sans-serif;  padding: 3px;  text-align: center;}

属性

この要素にはグローバル属性のみがあります。

使用上のメモ

  • ふつう<figure> は画像、イラスト、グラフ、コードの断片など、文書の本文の流れから参照されるものの、本文の流れに影響を与えることなく、文書のほかの部分や付録に移動することが可能なものに用います。
  • キャプションは<figure> 要素の中に(最初または最後の子要素として)<figcaption> 要素を挿入することで表すことができます。図の中で最初に見つかった最初の<figcaption> 要素が図のキャプションとして表示されます。

画像

html
<!-- 単なる画像 --><figure>  <img src="favicon-192x192.png" alt="美しい MDN のロゴ" /></figure><!-- キャプションが付いた画像 --><figure>  <img src="favicon-192x192.png" alt="美しい MDN のロゴ" />  <figcaption>MDN ロゴ</figcaption></figure>

結果

コードスニペット

html
<figure>  <figcaption><code>navigator</code> を用いてブラウザーの詳細を取得</figcaption>  <pre>function NavigatorExample() {  var txt;  txt = "Browser CodeName: " + navigator.appCodeName + "; ";  txt+= "Browser Name: " + navigator.appName + "; ";  txt+= "Browser Version: " + navigator.appVersion  + "; ";  txt+= "Cookies Enabled: " + navigator.cookieEnabled  + "; ";  txt+= "Platform: " + navigator.platform  + "; ";  txt+= "User-agent header: " + navigator.userAgent  + "; ";  console.log("NavigatorExample", txt);}  </pre></figure>

結果

引用

html
<figure>  <figcaption><b>Edsger Dijkstra:</b></figcaption>  <blockquote>    デバッグがソフトウェアのバグを取るプロセスであるならば、プログラミングはそれを入れるプロセスだ。  </blockquote></figure>

結果

html
<figure>  <p>    Bid me discourse, I will enchant thine ear, Or like a fairy trip upon the    green, Or, like a nymph, with long dishevelled hair, Dance on the sands, and    yet no footing seen: Love is a spirit all compact of fire, Not gross to    sink, but light, and will aspire.  </p>  <figcaption><cite>Venus and Adonis</cite>, by William Shakespeare</figcaption></figure>

結果

技術的概要

コンテンツカテゴリーフローコンテンツ,知覚可能コンテンツ.
許可されている内容<figcaption> 要素とそれに続くフローコンテンツ、またはフローコンテンツとそれに続く<figcaption> 要素、またはフローコンテンツ
タグの省略なし。開始タグと終了タグの両方が必須です。
許可されている親要素フローコンテンツを受け入れるすべての要素
暗黙の ARIA ロールfigure
許可されている ARIA ロール 子孫にfigcaption がない場合:any、それ以外の場合は許可されているロールなし
DOM インターフェイスHTMLElement

仕様書

Specification
HTML
# the-figure-element

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp