<legend>: フィールドセット凡例要素
        
        
          
                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月.
<legend> は HTML の要素で、その親要素である <fieldset> の内容のキャプションを表します。
試してみましょう
<fieldset>
  <legend>Choose your favorite monster</legend>
  <input type="radio" id="kraken" name="monster" value="K" />
  <label for="kraken">Kraken</label><br />
  <input type="radio" id="sasquatch" name="monster" value="S" />
  <label for="sasquatch">Sasquatch</label><br />
  <input type="radio" id="mothman" name="monster" value="M" />
  <label for="mothman">Mothman</label>
</fieldset>
legend {
  background-color: #000;
  color: #fff;
  padding: 3px 6px;
}
input {
  margin: 0.4rem;
}
属性
この要素には、グローバル属性以外の属性はありません。
例
<legend> の使用例は、 <form> のページを参照してください。
技術的概要
| コンテンツカテゴリー | なし | 
|---|---|
| 許可されている内容 | 記述コンテンツ および 見出し (h1–h6 要素) | 
| タグの省略 | なし。開始タグと終了タグの両方が必須です。 | 
| 許可されている親要素 | 
        <fieldset> 要素。<legend>
        要素は
        <fieldset>
        の最初の子要素として配置しなくてはならない。
       | 
    
| 暗黙の ARIA ロール | 対応するロールなし | 
| 許可されている ARIA ロール | 許可されている role なし | 
    
| DOM インターフェイス | HTMLLegendElement | 
    
仕様書
| Specification | 
|---|
| HTML> # the-legend-element>  | 
            
ブラウザーの互換性
Loading…