Bootstrap 有很多 examples for types of forms .我有兴趣使用看起来像这样的“水平形式”
这是使用 Web 检查器工具栏勾勒出一些元素后的样子:
我在一个弹出模式中工作,空间已经有点紧张了。我尝试将 Bootstrap 的网格系统的 .span1
和 .span2
作为一个类添加到标签中,但它没有提供所需的行为。
有没有办法使用 bootstrap 的其他方面来获得所需的行为(即收紧水平表单上标签占用的空间量)?这样做的正确方法是什么?我正在使用 Bootstrap 版本 2.1
最佳答案
我不知道 bootstrap 是否已经为它定义了一些东西..下面是一个解决方法..
<div class="control-group">
<label class="control-label" style="width:auto" for="inputEmail">Email</label>
<div class="controls" style="margin-left:auto">
<input type="text" class="input-small" id="inputEmail" placeholder="Email">
</div>
</div>
我添加了默认的 style="width:auto"
140px
和默认的 style="margin-left:auto"
160 像素
。还 class="input-small"
减少输入字段宽度以挤出更多空间,使其适合模态..
现在您可以根据需要进一步调整以适应它..
关于css - 如何使用 CSS 使 Bootstrap 水平表单标签变小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12433360/