Thuộc tính <fieldset> của HTML

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

form Thuộc tính này xác định lĩnh vực thuộc biểu mẫu.

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

Mô hình

Phần tử <fieldset> ngoài khu vực 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">Bạn thích màu gì nhất?</label>
  <input type="text" id="favcolor" name="favcolor">
  <input type="submit">
</form>
<fieldset form="form1">
  <legend>Thông tin cá nhân:</legend>
  <label for="fname">Tên:</label>
  <input type="text" id="fname" name="fname" form="form1"><br><br>
  <label for="lname">Họ:</label>
  <input type="text" id="lname" name="lname" form="form1">
</fieldset>

Thử ngay

Cú pháp

<fieldset form="form_id">

Giá trị thuộc tính

Giá trị Mô tả
form_id

Định nghĩa thẻ <fieldset> thuộc về phần tử biểu mẫu.

Giá trị của thuộc tính này phải là thuộc tính id của thẻ <form> trong cùng một tài liệu.

Hỗ trợ trình duyệt

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Hỗ trợ Hỗ trợ Hỗ trợ Hỗ trợ Hỗ trợ

Ghi chú:form Thuộc tính là thuộc tính mới trong HTML5.