It seems that fieldset defaults to 100% width of its container. Is there any way that you can have the field set just be as big as the widest control inside the fieldset?
It seems that fieldset defaults to 100% width of its container. Is there any way that you can have the field set just be as big as the widest control inside the fieldset?
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>
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.
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.
try this
<fieldset>
<legend style="max-width: max-content;" >Blah</legend>
</fieldset>
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.
i fixed my issue by override legend style as Below
.ui-fieldset-legend
{
font-size: 1.2em;
font-weight: bold;
display: inline-block;
width: auto;`enter code here`
}