jquery - 如何水平对齐 bootstrap 3 radio 和 radio 的标签?

标签 jquery html css twitter-bootstrap radio-button

<form class="form-horizontal">
  <label class="control-label in-line">Lover gender</label>
  <label class="radio-inline">
    <input type="radio" value="option1"> Male
  </label>
  <label class="radio-inline">
    <input type="radio" value="option2"> Female      </label>                       
</form>

请同时解释你的答案。

最佳答案

您需要使用 <form class="form-inline">对于内联表单:

http://getbootstrap.com/css/#forms-inline

还有内联 radio 的辅助类:

http://getbootstrap.com/css/#checkboxes-and-radios

这是一个关于 Bootply 的示例,它显示了您正在尝试执行的操作:

http://www.bootply.com/BCSk79TPOS

使用的代码是:

<form class="form-inline">
  <div class="radio-inline">
    <label for="option1">
      <input type="radio" id="option1"> Option 1
    </label>
  </div>
  <div class="radio-inline">
    <label for="option2">
      <input type="radio" id="option2"> Option 2
    </label>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>

关于jquery - 如何水平对齐 bootstrap 3 radio 和 radio 的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33269359/

相关文章:

javascript - 如何在不取消选中的情况下通过 Ajax 更新复选框列表

html - 如果同一图像在 HTML 页面中被多次引用,图像数据会传输一次还是多次?

javascript - div 和位置之间共享 100vh :sticky navbar

javascript - .load() 不加载脚本标签

html - CSS 列保持相同的高度

javascript - jquery 选择数组中除 id 之外的所有内容?

jquery - 验证今天选择的过去时间

javascript - 零高度文本区域不是零像素高

html - 我怎样才能将 flex 元素的内容居中?

php - 如何编写代码,如果 javascript 文件不加载再次重新加载?