Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the use of the fieldset HTML tag have meaning beyond grouping forms?

Usually, I've seen it with forms, but I've found it helpful to group related sets of data (eg when you have multiple tables on a page, using a fieldset around each table or group of related tables to define a visible meaning and a group name (legend)). Is this abusing the fieldset tag to the point where, in my uses, it no longer has semantic meaning?

like image 319
Thomas Owens Avatar asked Nov 24 '08 15:11

Thomas Owens


People also ask

What is the purpose of the Fieldset tag?

The <fieldset> tag is used to group related elements in a form. The <fieldset> tag draws a box around the related elements.

Can I use Fieldset for grouping in HTML?

<fieldset>: The Field Set element. The <fieldset> HTML element is used to group several controls as well as labels ( <label> ) within a web form.

Can Fieldset be used without form?

You can use any form elements outside of an actual form, since most of them can be used with JavaScript utilities outside the form. The form is only needed if you plan on allowing the user to submit the data with it.

How does Fieldset work in HTML?

The fieldset element is used to group related form controls and their labels within a web form. To mark-up for the fieldset includes a Start and an End tag. Multiple fieldset elements can be included inside a single form. In this example, there's a fieldset for contact details and a second fieldset for account details.


2 Answers

I believe this would be abuse. http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.10 states "The FIELDSET element allows authors to group thematically related controls and labels".

like image 133
mmiika Avatar answered Sep 26 '22 14:09

mmiika


The "field" bit in the name fieldset refers to <form> fields.

Using fieldset outside forms to group aribtrary data is clearly semantic misuse.

However, your HTML will validate and God will not Kill a Kitten.

like image 33
Már Örlygsson Avatar answered Sep 25 '22 14:09

Már Örlygsson