Set the width of a `<fieldset>` to the width of the largest containing element

css

Solution

Do you mean this: jsFiddle fieldset that is wide as biggest containing input-element

<form action="#" id="test" name="test">
    <fieldset>
        <input type="text" class="first" />
        <input type="text" class="second" />
        <input type="text" class="third" />

    </fieldset>

</form>

fieldset{
    overflow: hidden;
    float: left;
    background-color: #eee;
}
input {
    display: block;
}
input.first{ width: 150px; }
input.second{ width: 200px; }
input.third { width: 250px; }

It is a floating fieldset. If you want it in another way, please let us know.

Problem

Is there any way to have the width of a `<fieldset>` be the width of the largest field inside it?

Original source