Bootstrap horizontal form “control-label” not using responsive styling

不羁岁月 提交于 2019-12-05 01:22:34

问题


I'm using the "form-horizontal" class with Bootstrap 2, but my labels don't seem to be utilizing the Responsive styling. This is what it looks like:

When I examine it, it specifically has "width:160px" on the label, which is the regular Bootstrap setting, but the Responsive styling just has "width:auto".

My HTML for that section looks like this:

<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>

回答1:


bootstrap.css must be loaded before the bootstrap-responsive.css file.




回答2:


.control-label is only specified in responsive.css for (max-width: 480px). Have you tried shrinking the width way down? When I use the forms, they look like your example until 480px, at which point the labels move above the input fields.




回答3:


If you want to change as you add the class

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

Another solution is to directly specify a style ID width: auto

#title {
    width_auto;
}

Remember that your new style should be after the bootstrap css



来源:https://stackoverflow.com/questions/12804741/bootstrap-horizontal-form-control-label-not-using-responsive-styling

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