it seems that fieldset defaults to 100% width of its container. Is there anyway that you can have the field set just be as big as the widest control inside the fieldset ?
views:
1123answers:
4
A:
You can always use CSS to constrain the width of the fieldset, which would also constrain the controls inside.
I find that I often have to constrain the width of select
controls, or else really long option text will make it totally unmanageable.
Jonathan Julian
2010-02-20 14:42:00
but i want to have it dynamic so the fieldset will "autosize" and not be a predetermined width
ooo
2010-02-20 14:46:13
+5
A:
Use display: inline-block
, though you need to wrap it inside a DIV to keep it from actually displaying inline. Tested in Safari.
<style type="text/css">
.fieldset-auto-width {
display: inline-block;
}
</style>
<div>
<fieldset class="fieldset-auto-width">
<legend>Blah</legend>
...
</fieldset>
</div>
tvanfosson
2010-02-20 14:47:17
+3
A:
You could float it, then it will only be as wide as its contents, but you'll have to make sure you clear those floats.
Tom
2010-02-20 14:49:11
+2
A:
fieldset {display:inline} or fieldset {display:inline-block}
If you want to separate two fieldsets vertically, use a single <br/>
between them. This is semantically correct and no harder than it has to be.
Superstringcheese
2010-02-20 15:10:31