<legend>: Das Feldset-Überschrift-Element

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Das <legend> HTML-Element stellt eine Beschriftung für den Inhalt des übergeordneten <fieldset> dar.

Probieren Sie es aus

<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;
}

Attribute

Dieses Element enthält nur die globalen Attribute.

Beispiele

Siehe <form> für Beispiele zu <legend>.

Technische Zusammenfassung

Inhaltskategorien Keine.
Erlaubter Inhalt Textinhalt und Überschriften (h1–h6 Elemente).
Tag-Auslassung Keine, sowohl das Start- als auch das End-Tag sind obligatorisch.
Erlaubte Eltern Ein <fieldset>, dessen erstes Kind dieses <legend>-Element ist
Implizierte ARIA-Rolle Keine entsprechende Rolle
Erlaubte ARIA-Rollen Keine role erlaubt
DOM-Schnittstelle [`HTMLLegendElement`](/de/docs/Web/API/HTMLLegendElement)

Spezifikationen

Specification
HTML
# the-legend-element

Browser-Kompatibilität

Siehe auch