Forum Moderators: open

Message Too Old, No Replies

Fieldset only for Forms?

Why restricted only to one part of HTML?

         

GuanoLad

3:58 am on Feb 21, 2007 (gmt 0)

10+ Year Member



I can't see why Fieldset and Legend has been allocated for Forms only. They work perfectly fine elsewhere, there's nothing about it that seems particularly suited for Forms above any other part of HTML. They render quite nicely, and when styled up can make a page look quite tidy.

I could quite happily use it in a FAQ, for example, or encircle a highlighted paragraph.

What's the deal?

GuanoLad

6:45 am on Feb 26, 2007 (gmt 0)

10+ Year Member



Well, that's answered that, then. I can do anything I want.

RonPK

3:22 pm on Feb 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Semantics, I guess. It sounds like you're using the elements for presentational purposes, which is generally considered evil ;)

From the HTML 4.01 specs [w3.org]:

The FIELDSET element allows authors to group thematically related controls and labels. Grouping controls makes it easier for users to understand their purpose while simultaneously facilitating tabbing navigation for visual user agents and speech navigation for speech-oriented user agents. The proper use of this element makes documents more accessible.

So if you have a sign-up form for your social networking site, you could have fieldsets with legends like 'webdesign skills' to group the fields years and level, and 'painting skills' to group another set of years and level. By putting similarly labelled fields in distinct fieldsets, user agents can keep them apart.

(If I were an HTML specs author, I'd probably make LEGEND a property of FIELDSET rather than an element.)