bootstrap-4 - How do checkbox and href in the same line? Bootstrap 4
问题描述
<div class="form-group">
<div class="text-left">
<label class="checkbox-inline">
<input type="checkbox">Zapamiętaj mnie.
</label>
</div>
<div class="text-right">
<a href="#">Przypomnij hasło</a>
</div>
</div>
How can I do it in the same line?
解决方案
您可以将表单组设置为弹性容器,或将项目设置为内联元素。
您还可以使用Bootstrapform-inline
提供的类,您需要为所有输入元素和标签创建一个容器(最好使用标签)并将该类添加到其中。form
引用引导程序:
使用
.form-inline
该类在单个水平行上显示一系列标签、表单控件和按钮。内联表单中的表单控件与其默认状态略有不同。
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<!-- Making the form-group a flex-container -->
<div class="form-group d-flex">
<div class="text-left">
<label class="checkbox-inline">
<input type="checkbox">Zapamiętaj mnie.
</label>
</div>
<div class="text-right">
<a href="#">Przypomnij hasło</a>
</div>
</div>
<!-- Adding form-inline to a form container -->
<form class="form-inline">
<div class="form-group">
<div class="text-left">
<label class="checkbox-inline">
<input type="checkbox">Zapamiętaj mnie.
</label>
</div>
<div class="text-right">
<a href="#">Przypomnij hasło</a>
</div>
</div>
</form>
推荐阅读
- while-loop - 为什么不能等同于指向 nullptr 的指针
- macos - 无法使用 dcmodify 和 dcmscale 等 dcmtk 命令
- c# - 如何在具有嵌入列表的新重组对象列表中分发对象列表以更改根主键/索引?
- npm - 如何在 Yarn 包中同时使用?
- ios - 如何确定在 `application(_ app: UIApplication, open url: URL` 中使用哪个 URL 方案
- javascript - Moment.js 更改午夜时间重置
- python - 在具有不同移位长度的多列上使用 pandas .shift
- javascript - Sedo api 响应错误——SOAP Javascript 客户端
- asp.net - 如何向 NEST 添加多个字段?
- javascript - Vue 3 composition api typescript 从路由查询中填充对象属性