Connecting Tech Pros Worldwide Forums | Help | Site Map

Using <fieldset>/<legend> without forms

Ian Rastall
Guest
 
Posts: n/a
#1: Jul 20 '05
I'm curious as to the group's feelings about using the <fieldset>
and <legend> tags around elements other than <form> elements ... I
wrote a small test file:
<http://www.learnsomethingnew.us/fieldset.html>
to illustrate this, and it validated at both the W3C and WDG sites.
(It's a <fieldset> around a <table> and <p>).

I'm able to view it on Opera 7.23, Mozilla 1.6, and IE 6. (Moz 1.6
renders it in Standards Compliance Mode as well.)

This interests me, because it seems like such a shame that we can't
use <fieldset> for anything we want, since it's so handy. Here's the
write-up in the HTML 4.01 spec: <http://tinyurl.com/2sbn4>. I don't
know how to read a DTD, but I don't see any mention of forms except
in commented sections.

Is it likely that HTML written along these lines will break in
future browsers? If not, is there any compelling reason not to use
<fieldset> in any way that validates?

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/

Jukka K. Korpela
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Ian Rastall <idrastall@sbcglobal.net> wrote:
[color=blue]
> I'm curious as to the group's feelings about using the <fieldset>
> and <legend> tags around elements other than <form> elements ...[/color]
- -[color=blue]
> Is it likely that HTML written along these lines will break in
> future browsers?[/color]

Many people say that <fieldset> and <legend> are broken in _current_
browsers, not to mention old browsers that don't get them at all.

I think the main concern is user confusion. Form fields should look
like form fields, and other things shouldn't.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Harlan Messinger
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Using <fieldset>/<legend> without forms


"Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote:
[color=blue]
>Ian Rastall <idrastall@sbcglobal.net> wrote:
>[color=green]
>> I'm curious as to the group's feelings about using the <fieldset>
>> and <legend> tags around elements other than <form> elements ...[/color]
> - -[color=green]
>> Is it likely that HTML written along these lines will break in
>> future browsers?[/color]
>
>Many people say that <fieldset> and <legend> are broken in _current_
>browsers, not to mention old browsers that don't get them at all.[/color]

I'm curious what you mean by "broken". I've just used them for the
first time, and find them to look just as they ought to by default in
both IE6 and Mozilla, grouping controls and labeling them. Are they
meant to have some kind of function beyond that?[color=blue]
>
>I think the main concern is user confusion. Form fields should look
>like form fields, and other things shouldn't.[/color]

I'm guessing the OP is using form fields for some kind of client-side
application served over the web. Most users have no conception of what
an HTML form is or whether a given control is on one or not.
Semantically, if you're not submitting data for server-side
processing, shouldn't the controls be used without a <form>? But a
checkbox should still look to the user like a checkbox, and a button
like a button.


--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.
Bill Mason
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Ian Rastall wrote:
[color=blue]
> I'm curious as to the group's feelings about using the <fieldset>
> and <legend> tags around elements other than <form> elements ... I
> wrote a small test file:
> <http://www.learnsomethingnew.us/fieldset.html>
> to illustrate this, and it validated at both the W3C and WDG sites.
> (It's a <fieldset> around a <table> and <p>).[/color]

If a fieldset contains no fields, is it a fieldset?
[color=blue]
> This interests me, because it seems like such a shame that we can't
> use <fieldset> for anything we want, since it's so handy.[/color]

I don't see why it is so handy in your example. What is the purpose of
having it, besides the visual effect?
[color=blue]
> Is it likely that HTML written along these lines will break in
> future browsers? If not, is there any compelling reason not to use
> <fieldset> in any way that validates?[/color]

Semantics. A fieldset "allows authors to group thematically related
controls and labels". You are not using it to group any form
controls/labels at all.

It appears that the only use for it here is the default visual effect in
browsers, one that wouldn't be that hard to replicate with more
semantically accurate tags.

--
Bill Mason
Accessible Internet
http://www.accessibleinter.net/
prefix @accessibleinter.net with anything to reply
Neal
Guest
 
Posts: n/a
#5: Jul 20 '05

re: Using <fieldset>/<legend> without forms


On Sun, 01 Feb 2004 23:52:50 -0500, Ian Rastall <idrastall@sbcglobal.net>
wrote:
[color=blue]
> This interests me, because it seems like such a shame that we can't
> use <fieldset> for anything we want, since it's so handy.[/color]

Yeah, and it's a shame we can't wrap the whole body in a <h1> tag since
that looks cool too. Plus it solves the readability issue.
Ian Rastall
Guest
 
Posts: n/a
#6: Jul 20 '05

re: Using <fieldset>/<legend> without forms


On Wed, 04 Feb 2004 04:10:28 GMT, Bill Mason
<usenet@accessibleinter.net> wrote:
[color=blue]
> I don't see why it is so handy in your example.[/color]

It wasn't meant to illustrate its usefullness ... just that it
rendered.
[color=blue]
> What is the purpose of having it, besides the visual effect?[/color]

It's just another way of grouping things together. The advantage
over using, say, a <div> with a border, is that you can label it. In
a site with headline news, for instance, you could organize the
headlines in this way, and make the contents of the <legend> tag a
link to the full article. In fact, despite the impression it makes
of being purely visual, it seems like more of a structural tag.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Ian Rastall
Guest
 
Posts: n/a
#7: Jul 20 '05

re: Using <fieldset>/<legend> without forms


On Wed, 04 Feb 2004 04:18:49 -0500, Ian Rastall
<idrastall@sbcglobal.net> wrote:
[color=blue]
> In a site with headline news, for instance, you could organize the
> headlines in this way, and make the contents of the <legend> tag a
> link to the full article.[/color]

Come to think of it, being able to use a <legend> tag to add a
caption to a bordered <div> could be very useful ... forget
<fieldset>.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Harlan Messinger
Guest
 
Posts: n/a
#8: Jul 20 '05

re: Using <fieldset>/<legend> without forms



"Harlan Messinger" <hmessinger.removethis@comcast.net> wrote in message
news:rmp020dtl4bid1t75kqkq5s2gdglgod9ti@4ax.com...[color=blue]
> "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote:[/color]

I'm sorry, I responded without having looked at his page. Obviously he's NOT
using fieldset the way it's meant to be used. He's using it for a look and
feel that is out of place and on which he can't depend from browser to
browser.

Jukka K. Korpela
Guest
 
Posts: n/a
#9: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Harlan Messinger <hmessinger.removethis@comcast.net> wrote:
[color=blue][color=green]
>>Many people say that <fieldset> and <legend> are broken in _current_
>>browsers, not to mention old browsers that don't get them at all.[/color]
>
> I'm curious what you mean by "broken". I've just used them for the
> first time, and find them to look just as they ought to by default in
> both IE6 and Mozilla, grouping controls and labeling them. Are they
> meant to have some kind of function beyond that?[/color]

The people who say that they are broken mainly refer to the visual
appearance that has a border around the fieldset, with the legend
partly covering it. And is there any _functionality_ associated with
fieldset markup? Besides, making the legend obligatory is odd (though
in practice it can be left empty).

It's largely a matter of taste whether such appearance is good or bad,
but it seems to be difficult to style it in CSS - actually I don't
think there's a way to _describe_ all of its features in CSS even in
principle.

I find it somewhat strange that some people refuse to use fieldset in
forms due to the persistent appearance which they regard as poor, and
some other people would use fieldset just because of the appearance.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Harlan Messinger
Guest
 
Posts: n/a
#10: Jul 20 '05

re: Using <fieldset>/<legend> without forms



"Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote in message
news:Xns9485D956A13AFjkorpelacstutfi@193.229.0.31. ..[color=blue]
> Harlan Messinger <hmessinger.removethis@comcast.net> wrote:
>[color=green][color=darkred]
> >>Many people say that <fieldset> and <legend> are broken in _current_
> >>browsers, not to mention old browsers that don't get them at all.[/color]
> >
> > I'm curious what you mean by "broken". I've just used them for the
> > first time, and find them to look just as they ought to by default in
> > both IE6 and Mozilla, grouping controls and labeling them. Are they
> > meant to have some kind of function beyond that?[/color]
>
> The people who say that they are broken mainly refer to the visual
> appearance that has a border around the fieldset, with the legend
> partly covering it.[/color]

They call that broken? I don't know about other OSes, but that's what
control group frames have looked like on Windows all along. I never saw
anything wrong with it.
[color=blue]
> And is there any _functionality_ associated with
> fieldset markup? Besides, making the legend obligatory is odd (though
> in practice it can be left empty).
>
> It's largely a matter of taste whether such appearance is good or bad,
> but it seems to be difficult to style it in CSS -[/color]

Ah. I see.
[color=blue]
> actually I don't
> think there's a way to _describe_ all of its features in CSS even in
> principle.
>
> I find it somewhat strange that some people refuse to use fieldset in
> forms due to the persistent appearance which they regard as poor, and
> some other people would use fieldset just because of the appearance.[/color]

Michael Rozdoba
Guest
 
Posts: n/a
#11: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Jukka K. Korpela wrote:

[snip fieldset/legend comments]
[color=blue]
> It's largely a matter of taste whether such appearance is good or bad,
> but it seems to be difficult to style it in CSS - actually I don't
> think there's a way to _describe_ all of its features in CSS even in
> principle.[/color]

As a matter of interest, can I ask which features you have in mind that
present a problem?

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Jukka K. Korpela
Guest
 
Posts: n/a
#12: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Michael Rozdoba <mroz@nowhere.invalid> wrote:
[color=blue][color=green]
>> It's largely a matter of taste whether such appearance is good or
>> bad, but it seems to be difficult to style it in CSS - actually I
>> don't think there's a way to _describe_ all of its features in CSS
>> even in principle.[/color]
>
> As a matter of interest, can I ask which features you have in mind
> that present a problem?[/color]

I don't there's a way to describe the rounded corners that e.g. IE
on WinXP uses. Setting border properties for fieldset affects its
special border in some cases (property/browser combinations) only.
The placement of the legend might be describeable using positioning or
negative margins, but I'm not sure how well that would work in
practice, especially since we don't really know what browsers are
doing.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Michael Rozdoba
Guest
 
Posts: n/a
#13: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Jukka K. Korpela wrote:[color=blue]
> Michael Rozdoba <mroz@nowhere.invalid> wrote:
>
>[color=green][color=darkred]
>>>It's largely a matter of taste whether such appearance is good or
>>>bad, but it seems to be difficult to style it in CSS - actually I
>>>don't think there's a way to _describe_ all of its features in CSS
>>>even in principle.[/color]
>>
>>As a matter of interest, can I ask which features you have in mind
>>that present a problem?[/color]
>
>
> I don't there's a way to describe the rounded corners that e.g. IE
> on WinXP uses.[/color]

Ah, I've not seen that; yes, it would be tricky.
[color=blue]
> Setting border properties for fieldset affects its
> special border in some cases (property/browser combinations) only.[/color]

Ok.
[color=blue]
> The placement of the legend might be describeable using positioning or
> negative margins, but I'm not sure how well that would work in
> practice, especially since we don't really know what browsers are
> doing.[/color]

Yes, this is the bit I had a fiddle with. Thought I'd cracked it with
http://osiris.sunderland.ac.uk/~cd2m...gySeeOpera.htm
but as the file name implies, it doesn't work with Opera (& in any case,
the use of span is hacky in that context).

Putting the legend text into the group div with suitable 0 margin &
padding & setting line height to 0 gets the right result in IE 6 &
Firebird 0.7, but not in Opera 7.23.

A read of the spec suggests Opera is getting it right by assuming
vertical-align of baseline within this zero height box aligned with the
div top border. Setting other aligns on the Span fixes this in Opera but
breaks it in IE. So even if the spec allows it, it doesn't seem to be
easily doable in practice.

A previous attempt with negative margins also looked promising but broke
in IE & I think I've read use of negative margins is less reliable in
practice than tinkering with line-height.

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Vladdy
Guest
 
Posts: n/a
#14: Jul 20 '05

re: Using <fieldset>/<legend> without forms


Ian Rastall wrote:[color=blue]
> On Wed, 04 Feb 2004 04:10:28 GMT, Bill Mason
> <usenet@accessibleinter.net> wrote:
>
>[color=green]
>>I don't see why it is so handy in your example.[/color]
>
>
> It wasn't meant to illustrate its usefullness ... just that it
> rendered.
>
>[color=green]
>>What is the purpose of having it, besides the visual effect?[/color]
>
>
> It's just another way of grouping things together. The advantage
> over using, say, a <div> with a border, is that you can label it. In
> a site with headline news, for instance, you could organize the
> headlines in this way, and make the contents of the <legend> tag a
> link to the full article. In fact, despite the impression it makes
> of being purely visual, it seems like more of a structural tag.
>
> Ian[/color]
If you are just after the looks, you can achieve pretty much the same
rendering with a regular markup:
http://www.vladdy.net/demos/fieldsetlegendlook.html

--
Vladdy
http://www.klproductions.com
Nick Kew
Guest
 
Posts: n/a
#15: Jul 20 '05

re: Using <fieldset>/<legend> without forms


In article <Xns9485D956A13AFjkorpelacstutfi@193.229.0.31>,
"Jukka K. Korpela" <jkorpela@cs.tut.fi> writes:[color=blue]
> And is there any _functionality_ associated with
> fieldset markup?[/color]

Most obviously, a group of radio buttons is a functional
relationship and benefits from being presented to the user.

Otherwise, it may serve to delimit an entire Form or part.

--
Nick Kew
Closed Thread


Similar HTML / CSS bytes