混合收音机与html中的选中按钮

时间:2017-05-18 20:48:53

标签: html

我想混合收音机和选中按钮,就像我设计B https://ux.stackexchange.com/questions/70531/using-mixed-radio-and-checkbox-buttons-is-there-any-efficiency-or-usability-ga

一样

但我可以弄清楚如何单独做:

<input class="radio-input" type="radio" name="result" value="names" />
<label class="radio-label">Get names of people starting with..</label>
<input type="checkbox" id="A" name="name[]" value="n">
<label for="A">A</label>
<input type="checkbox" id="B" name="name[]" value="n">
<label for="B">B</label>

我如何在设计B中这样做?

1 个答案:

答案 0 :(得分:0)

您必须将它们放入单独的div中,然后使用CSS样式将它们对齐以使它们彼此相邻。

.no-bullets {
  list-style:none;
}
   
  <h2>first row</h1>


  <ul class = "no-bullets">
    <li> <input type="radio" name="name"></li>
    <li> <input type="radio" name="name"></li>
    
    <ul class = "no-bullets">  
    <li><input type="checkbox" name="sex"></li>
    <li><input type="checkbox" name="sex"></li>
    <li><input type="checkbox" name="sex"></li>
    </ul>
  </ul>
</div>