<legend>

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.

HTML-элемент <legend> представляет собой заголовок содержания родительского элемента <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;
}
Категории контента Нет
Допустимый контент Фразовый контент.
Пропуск тегов Нет, открывающий и закрывающий теги обязательны.
Допустимые родители Является дочерним элементом тега <fieldset>
Допустимые ARIA-роли Нет
DOM-интерфейс HTMLLegendElement

Атрибуты

Этот элемент включает только универсальные атрибуты.

Примеры

Смотрите <form> для примеров использования элемента <legend>.

Спецификации

Specification
HTML
# the-legend-element

Совместимость с браузерами

BCD tables only load in the browser

Смотрите также