Bootstrap水平表单“control-label”不使用响应式样式

时间:2012-10-09 16:50:34

标签: twitter-bootstrap twitter-bootstrap-2

我正在使用Bootstrap 2的“form-horizo​​ntal”类,但我的标签似乎没有使用Responsive样式。这就是它的样子:

enter image description here

当我检查它时,它在标签上特别具有“width:160px”,这是常规的Bootstrap设置,但是Responsive样式只有“width:auto”。

该部分的HTML如下所示:

<form id="addproject" class="form-horizontal">
    <div class="control-group">
        <label for="title" class="control-label">Title</label>
        <div class="controls">
            <input type="text" name="title" id="title" />
        </div>
    </div>
</form>

3 个答案:

答案 0 :(得分:1)

.control-label仅在responsive.css中指定(max-width:480px)。你试过缩小宽度吗?当我使用表单时,它们看起来像你的例子,直到480px,此时标签移动到输入字段之上。

答案 1 :(得分:1)

必须在bootstrap.css文件之前加载

bootstrap-responsive.css

答案 2 :(得分:0)

如果您想在添加课程时进行更改

<input type="text" name="title" id="title" class="span3" />

另一种解决方案是直接指定样式ID宽度:auto

#title {
    width_auto;
}

请记住,你的新风格应该在bootstrap css之后