我想使用CSS对齐我的单选按钮



我试图用html和css做一个表单调查。我希望我的收音机按钮能垂直对齐,但我有点卡住了,因为我已经尝试了一段时间。这是我的代码:

<p>Choose your education level:</p>
<input type="radio" name="education" value="1">High School degree</input>
<br>
<input type="radio" name="education" value="2">College degree</input>
<br>
<input type="radio" name="education" value="3">Masters degree</input>
<br>
<input type="radio" name="education" value="4">PhD degree</input>

and my CSS code is:
input[type=radio] {
text-align: left;
}

试试这个代码

input[type=radio] {
vertical-align: middle;
margin: 0 10px 0 0;
}
<p>Choose your education level:</p>
<input type="radio" name="education" value="1">High School degree
<br>
<input type="radio" name="education" value="2">College degree
<br>
<input type="radio" name="education" value="3">Masters degree
<br>
<input type="radio" name="education" value="4">PhD degree

相关内容

  • 没有找到相关文章

最新更新