【HTML】figure  - コンテンツのまとまり

【HTML】figure - コンテンツのまとまり

HTMLのfigureタグをご紹介します。

figureタグ

figureタグは画像や動画、コードなどのコンテンツのまとまりをマークアップします。

基本構文

<figure>
    コンテンツ要素(imgやaudio、videoなど)
    <figcaption>見出しや説明</figcaption>
</figure>

figure要素内のコンテンツに見出しや説明を付けるにはfigcaptionタグを使用します。

figcaption

figcaptionタグはfigure要素内コンテンツの見出しや説明をマークアップします。

サンプルコード

<figure>
    <img src="/storage/app/media/image/hacker-commandline-2048x1365.jpeg">
    <figcaption>Appを開発するエンジニア</figcaption>
</figure>