【发布时间】:2019-04-04 22:07:31
【问题描述】:
我正在实现一个包含一些单选按钮的表单。使用 Bootstrap 4,我想使用 .form-check-inline 使它们水平对齐,但有将它们与输入标签放在同一行的副作用:
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
</head>
<body>
<div class="container">
<form>
<div class="form-group">
<label>Label</label>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input type="radio" name="test">
Option 1
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input type="radio" name="test">
Option 2
</label>
</div>
</div>
</form>
</div>
</body>
</html>
.. 这对我来说看起来不太好。 我实际上希望标签保留在自己的行中,单选按钮位于下一行。如何在尊重 Bootstrap 模式的同时实现这一目标?
【问题讨论】:
标签: html css forms bootstrap-4