How to make legend extend full width of fieldset and maintain content padding?

Alpha

New Member
My goal is to render fieldsets with a border and the legend to be located at the top with a background color. The background color of the legend should extend to the full width of the fieldset.Based on http://stackoverflow.com/questions/6312799/make-a-legend-fill-up-the-full-width-within-the-fieldset.It looks good, but fieldset has no padding, so the form elements are too close to the borders. When I add in the padding, I am left with: http://jsfiddle.net/pdgreen/wcYXX/1/.The content looks fine, but the title not longer extends the the width of the fieldset.If I surround the content with a \[code\]div\[/code\], I can add in the padding: http://jsfiddle.net/pdgreen/wcYXX/2/, however that requires the additional \[code\]div\[/code\].Is there a way to make it look like the third fiddle, without the extra \[code\]div\[/code\]?
 
Back
Top