how center a checkbox underneath label using bootstrap?

给你一囗甜甜゛ 提交于 2020-06-18 19:56:09

问题


in a bootstrap form, the checkbox appears off to the right and the label is to the left. How to center the checkbox under the label?

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<form>
  <div class="form-row">
  <div class="form-group col-md-2">
    <label for="isNewPrice">New price?</label>
    <input type="checkbox" class="form-control" id="isNewPrice" >
  </div>
</div>
</form>

回答1:


Maybe with a text-center class ?

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<form>
  <div class="form-row">
  <div class="form-group col-md-2 text-center">
    <label for="isNewPrice">New price?</label>
    <input type="checkbox" class="form-control" id="isNewPrice" >
  </div>
</div>
</form>


来源:https://stackoverflow.com/questions/49778045/how-center-a-checkbox-underneath-label-using-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!