我们使用<fieldset>标签,对HTML表单中的相关数据进行分组。该标签在网页上的相关元素周围创建一个框。 <legend> 标签在 <fieldset> 标签内使用,为组提供标题或为组提供名称。
语法
<fieldse>…..</fieldset>
示例 1
以下是使用<legend>标签在<fieldset>标签内对HTML表单中的数据进行分组的示例 -
<!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <Meta name="description" content="Meta tag in the web document"> <Meta name="keywords" content="HTML,CSS"> <Meta name="author" content="lokesh"> <Meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <form> <fieldset> <legend>Employee Details</legend> Employee Name<br> <input type="text" name="Ename"> <br> Employee ID<br> <input type="text" name="Eid"> <br> Employee Address<br> <input type="text" name="Eid"> <br> </fieldset> </form> </body> </html>
示例2
您可以尝试运行以下代码来对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>
以上就是我们如何在HTML表单中对数据进行分组?的详细内容,更多请关注编程之家其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。