know_everything
know_everything

Reputation: 123

How to put radio buttons in one line inside form?

I have written the following code:

  male    <input type="radio" name="sex" value="male">
female    <input type="radio" name="sex" value="female">
 other    <input type="radio" name="sex" value="other">

All this is inside a form. How can I get them on one single line?

Upvotes: 0

Views: 4530

Answers (2)

Robin Andersson
Robin Andersson

Reputation: 87

If you want the dots to go in a line from left to right, you are done. If you want to dots to go from top to bottom you can simple do:

  male    <input type="radio" name="sex" value="male"><br>
female    <input type="radio" name="sex" value="female"><br>
 other    <input type="radio" name="sex" value="other">

<br> makes them jump to the next line

Upvotes: 1

Xaver
Xaver

Reputation: 11652

Wrap them in a label tag

<label>male    <input type="radio" name="sex" value="male"></label>
<label>female    <input type="radio" name="sex" value="female"></label>
<label>other    <input type="radio" name="sex" value="other"></label>

also check if no styles are applied to the input elements which may display them as block elements

Upvotes: 2

Related Questions