Reputation: 127
Can anybody tell me how to style the following fieldset so the legend and the radiobuttons are all on the one line?
<fieldset>
<legend>Are you from planet earth?</legend>
<label><input type="radio" name="answer"/>Yes</label>
<label><input type="radio" name="answer"/>No</label>
</fieldset>
Upvotes: 3
Views: 2582
Reputation: 1804
The answers are a bit stale. float: left;
will work, but can cause other layout issues and requires clearing the float on subsequent containers.
Nowadays, flexbox
or CSS Grid Layout have excellent modern browser support.
Upvotes: 0
Reputation: 847
This will work. Just float them left. Probably a better way to do it, but it works.
<fieldset>
<legend style='float:left'>Are you from planet earth?</legend>
<label style='float:left'><input type="radio" name="answer"/>Yes</label>
<label style='float:left'><input type="radio" name="answer"/>No</label>
</fieldset>
Upvotes: 0