Fieldset size question?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I've used the <fieldset> and <legend> tags successfully in the past.
However, now that I'm transitioning over to stricter XHTML and css I'm
running into a problem that I simply cannot find the answer to.

Perhaps some of you "seasoned" folks can advise?

Normally, when I have a form with various <input> elements within I wrap the
entire section in a <fieldset> pair and it display a nice fitting single
line box around my form elements.  Looked great!

However, now that I am coding with css when I either introduce the
<fieldset> tag or migrate some code over, the surrounding box displays from
edge to edge inside the current DIV box.  I've tried various position
elements, even centering, but it still always wants to fill the entire
left/right areas.

Can anyone please shed some light on what I might be missing on this concept
and/or what may be different in the handling of this TAG when using css?

Thanks in advance.


Re: Fieldset size question?

Scripsit bobmct:

Quoted text here. Click to load it


A URL would tell us more than 1,024 words. Anyway, moving to XHTML is
probably pointless - you are either several years behind (of the fashion
that never had a point) or several years ahead of time. Besides, (X)HTML is
either Strict or it is not.

Quoted text here. Click to load it

Maybe. A URL would let us decide. Anyway, if you group _all_ elements inside
a <fieldset>, you might be doing the wrong thing. The <fieldset> element is
supposed to _group_ fields logically. Typically, a set of radio buttons with
their labels, acting as one logical unit.

If you just want a border around an entire form, simply use CSS for that.
You won't get rounded corners (except via considerable trickery), but
drawing a border is easy. Making the box just as wide as needed is a bit
difficult. But please tell us what the markup is and exactly how it should
appear visually - preferably in c.i.w.a.stylesheets.

Quoted text here. Click to load it


Quoted text here. Click to load it

I guess you have a box sizing issue and actually a CSS problem, not an HTML

However, you _could_ (effectively) draw a border around a form using old
dirty non-Strict Transitional deprecated anathema boo-boo markup, which
works pretty well:

<form ...>
<table border="1" cellspacing="0"><tr><td>
<div>Some stuff here id desired.</div>
<div><label ...><input ...></div>

Then you can throw in some CSS to color the border, create nice padding
etc., e.g.

<style type="text/css">
table { border: solid green 1px; }
td { padding: 0.1em 0.3em; }

Jukka K. Korpela ("Yucca")

Site Timeline