Thuộc tính biểu mẫu HTML <fieldset>

❮ Thẻ HTML <fieldset>

Thí dụ

Phần tử <fieldset> nằm bên ngoài biểu mẫu (nhưng vẫn là một phần của biểu mẫu):

<form action="/action_page.php" method="get" id="form1">
  <label for="favcolor">What is your favorite color?</label>
  <input type="text" id="favcolor" name="favcolor">
  <input type="submit">
</form>

<fieldset form="form1">
  <legend>Personalia:</legend>
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname" form="form1"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname" form="form1">
</fieldset>

Định nghĩa và Cách sử dụng

Thuộc formtính chỉ định dạng mà tập trường thuộc về.

Giá trị của thuộc tính này phải bằng idthuộc tính của một <form> phần tử trong cùng một tài liệu.


Hỗ trợ trình duyệt

Attribute
form Yes Yes Yes Yes Yes

Cú pháp

<fieldset form="form_id">

Giá trị thuộc tính

Value Description
form_id Specifies the form element the <fieldset> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document.

❮ Thẻ HTML <fieldset>