html - Bootstrap 3 中的奇怪按钮包装 - 响应式设计

标签 html css twitter-bootstrap-3

我是 Bootstrap 3 新手,所以这可能就像代码结构问题一样简单。 770 像素以上的一切看起来都很棒,但在 770 像素以下有些东西有点破损。 1.) 搜索按钮不会向左浮动。 2.) 选择菜单需要 100% 宽度。堆叠菜单很好。

https://jsfiddle.net/nataliehatter/p55j2sp2/

HTML

<div class="well" style="padding:10px;">
                 <h5>Search Businesses</h5>
    <form class="form-inline">
    <label class="sr-only" for="selectLocation">Select Location</label>
    <select class="form-control searchSelect" id="selectLocation">
        <option selected="selected" value>Select Location</option>
        <optgroup label="U.S. Regions">
            <option value="R70">Atlantic</option>
        </optgroup>
        <optgroup label="U.S. States">
            <option value="1">Alabama</option>
        </optgroup>
    </select>
    <label class="sr-only" for="selectIndustry">Select Industry</label>
    <select class="form-control searchSelect" id="selectIndustry">
        <option selected="selected" value>Select Industry</option>
    </select>
    <label class="sr-only" for="selectIndustrySegment">Select Industry Segment</label>
    <select class="form-control searchSelect" id="selectIndustrySegment">
        <option selected="selected" value>Select Industry Segment</option>
    </select>
    <button type="submit" class="btn btn-success searchBusBtn">Search Businesses</button>
</form>
</div>

CSS

 .form-control.searchSelect {
            width:25%;
            margin-right:5px;
        }
    .searchBusBtn {
        float:right;
    }
        @media screen (max-width: 768px;) {
            .form-control.searchSelect {
                width:auto;
            }
            .searchBusBtn {
                float:left;
            }
        }

最佳答案

改变你的媒体查询

@media screen (max-width: 768px;)

@media screen and (max-width:768px)

CSS 中的以下代码是您在布局中需要的代码: JsFiddle-Update 2

.form-control.searchSelect {
    width:25%;
    margin-right:5px;
}
.searchBusBtn {
    float:right;
}
@media screen and (max-width:768px) {
    .form-control.searchSelect {
        width:100%;
        margin:5px 0 0 0;
    }
    .searchBusBtn {
        float:left;
        margin:10px 0 0 0;
    }
    .well {
        float:left;
        width:100%;
    }
}

关于html - Bootstrap 3 中的奇怪按钮包装 - 响应式设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29221103/

相关文章:

javascript - 有没有办法找到鼠标指针半径?

javascript - 尝试在 html 中链接两个或多个页面,但加载页面时出错

css - LESS 编译器神奇地将不需要的类添加到我的选择器中

css - 表格内部表格和 Twitter Bootstrap 中的内部模式都无法正确显示,缺少填充

javascript - 如何设置使用 JavaScript 函数添加的文本字符串的样式?

php - 如何在 Wordpress 中创建图像滚动导航按钮

html - 是否可以将下拉列表置于药丸下方(Bootstrap)?

python - 如何将背景图片网址设为静态

css - 无法清除图像

javascript - 导航子页面时保持下拉菜单打开