如何垂直对齐单选按钮?

时间:2017-08-08 23:42:52

标签: html css button alignment radio

所以我想要一张带有问题和五个单选按钮的表格。但正如你所看到的,使用不同的问题长度这是一个混乱。尽管问题的长度很长,但如何很好地对齐按钮,使它们垂直位于标题下?

[IMG] http://i68.tinypic.com/vpkftw.png[/IMG]

这是html:

<h4> Ans1  </h4><h4>Answer2 </h4><h4> Ans3 </h4><h4> Ans4 </h4><h4>Ans5 </h4> <br>
Q1 ......................      <input type="radio" name="v1" id="v1_1" value="1"> <input type="radio" name="v1" id="v1_2" value="Bike"> <input type="radio" name="v1" id="v1_3" value="Bike"> <input type="radio" name="v1" id="v1_4" value="Bike"> <input type="radio" name="v1" id="v1_5" value="Bike"> <br>
Q2... <input type="radio" name="v2" id="v2_1" value="Bike"> <input type="radio" name="v2" id="v2_2" value="Bike"> <input type="radio" name="v2" id="v2_3"value="Bike"> <input type="radio" name="v2" id="v2_4" value="Bike"> <input type="radio" name="v2" id="v2_5" value="Bike"> <br>
Q3.<input type="radio" name="v3" id="v3_1" value="Bike"> <input type="radio" name="v3" id="v3_2" value="Bike"> <input type="radio" name="v3" id="v3_3"value="Bike"> <input type="radio" name="v2" id="v3_4" value="Bike"> <input type="radio" name="v2" id="v3_5" value="Bike"> <br>
Q4 <input type="radio" name="v4" id="v4_1" value="Bike"> <input type="radio" name="v4" id="v4_2" value="Bike"> <input type="radio" name="v4" id="v4_3"value="Bike"> <input type="radio" name="v4" id="v4_4" value="Bike"> <input type="radio" name="v4" id="v4_5" value="Bike"> <br>

CSS:

h4 {
display: inline;
position: relative;
left: 280px;

}

h4:nth-child(2) {
margin-left:6em;

}


h4:nth-child(3) {
margin-left:5em;


}


h4:nth-child(4) {
margin-left:7em;

}

h4:nth-child(5) {
margin-left:4em;

}

1 个答案:

答案 0 :(得分:0)

我建议把你的html放在一张桌子里,就像你在这里看到的那样没有边框,线条等等。但如果是这样,只需使用 WITH demo AS ( SELECT /*+ CURSOR_SHARING_EXACT */ <col1> from <table_name> where <some_conditions>) SELECT CASE WHEN d.col1 IS NOT NULL THEN 'Y' ELSE 'N' END temp FROM dual, demo d; 删除它,例如: https://codepen.io/anon/pen/mMmydy

border:0px;