html - Bootstrap 内联表单堆叠在彼此之上

标签 html css twitter-bootstrap-3

我有一个问题,当它全屏显示时,它看起来也是如此。但是当我开始缩小尺寸时,一旦我开始移动,第一个表单组就会一直扩展表单,并将第二个表单组向下移动到一个新行。

即使缩小到移动 View ,我也希望两个表单组在同一行

         <div class = "container col-xs-12 col-sm-6 col-lg-5 center-block">
            <form class="form-inline">

             <div class="form-group">

                <label>Start:</label>
                <input type="text" class="form-control" placeholder="{{ start_length }}" id="bar">

             </div>
             <div class="form-group pull-right">

                <label>End: </label>
                <input type="text" class="form-control" placeholder="{{ end_length }}" id="bar1">

             </div>

            </form>
         </div>

jsfiddle

最佳答案

也许 media queries 的这种使用会给你想要的东西——或者至少会为你指出一些可能的方向:

参见 fiddle here .

CSS

.center-block {float: none !important}
.inline{
display:inline-block!important;
width:auto!important;
}


@media only screen and (min-width : 320px) {
    input[type="text"] {
    width: 110px;
    background-color: yellow;
}       
}

/* Extra Small Devices, Phones */ 
@media only screen and (min-width : 480px) {
input[type="text"] {
width:110px;
background-color: red;
}

}

/* Small Devices, Tablets */
@media only screen and (min-width : 768px) {
input[type="text"] {
width: 110px;
background-color: blue;
}
}      
/* Medium Devices, Desktops */
@media only screen and (min-width : 992px) {
input[type="text"] {
width: 110px;
background-color: grey;
}
}

/* Large Devices, Wide Screens */
@media only screen and (min-width : 1200px) {
input[type="text"] {
width: 120px;
background-color: green;
}
}

html

    <div class = "container col-xs-12 col-sm-8 col-lg-6 center-block">
        <form class="form-inline inline">

         <div class="form-group pull-left">

            <label>Start:</label>
            <input type="text" class="form-control" placeholder="{{ start_length }}" id="bar">

         </div>
         <div class="form-group pull-right">

            <label>End: </label>
            <input type="text" class="form-control" placeholder="{{ end_length }}" id="bar1">

         </div>

        </form>
     </div>

关于html - Bootstrap 内联表单堆叠在彼此之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30799803/

相关文章:

javascript - 在 Javascript 中旋转对象标签 (PDF)

html - UL 在 LI 下,尽管有 block 和内联

angular-ui-bootstrap 颜色更改的 css nav 不起作用

html - 带有静止标题的表格

单独文件中的 Javascript 不起作用

html - inline-block CSS 属性的对齐问题

css - 将广告滚动条加载到我的网站期间的 G+1 按钮

css - Bootstrap 3 网格系统的嵌套问题

html - 我应该为歌曲列表使用 html 表格还是 div?

asp.net - CSS 3 动画效果在 IE 中不起作用