Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> HTML

Cách nhóm dữ liệu (group data) trong form HTML?

Để nhóm dữ liệu liên quan trong form HTML, dùng thẻ <fieldset>. Thẻ này tạo một khung bao quanh các phần tử liên quan. Thẻ <legend> dùng bên trong <fieldset> để thêm tiêu đề cho nhóm.

Cách nhóm dữ liệu (group data) trong form HTML?

Ví dụ

Chạy mã sau để nhóm dữ liệu trong form HTML:

<!DOCTYPE html> <html>    <body>       <form>          <fieldset>             <legend>Student Information:</legend>             Student Name:<br>             <input type="text" name="sname">             <br>             Student Subject:<br>             <input type="text" name="ssubject">             <br>          </fieldset>       </form>    </body> </html>