问题:如何在Bootstrap 3.2.0导航栏中获得最大化的搜索输入?
在Bootstrap 3.1.1中,我使用以下代码作为固定的底部导航栏来显示最大化的搜索输入.
<nav class="navbar navbar-default navbar-fixed-bottom" role="seasrch"> <div class="container"> <form class="navbar-form"> <div class="form-group"> <div class="input-group input-group-sm"> <div class="input-group-btn"> <a href="#" id="new_term" class="btn btn-default" role="button"><span class="glyphicon glyphicon-leaf"></span> New</a> <a href="/terms.PHP" class="btn btn-default" role="button"><span class="glyphicon glyphicon-tree-deciduous"></span> All</a> </div> <input type="input" class="form-control" name="search_bar_text" /> <div class="input-group-btn"> <button class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button> </div> </div> </div> </form> </div> </nav>
它看起来像这样:
升级到Bootstrap 3.2.0后,我的导航栏看起来像这样:
解决方法
我从3.1.1升级到3.2.0时遇到了同样的意外体验 – 我的(顶部)导航栏形式过去占据了屏幕的全宽,现在只是一个短元素.这是我在Boostrap之后加载的自定义CSS中有用的东西(这是我在保留原始干净缩小版本的同时覆盖Bootstrap的方式):
/* Boostrap CSS 3.2.0 had these new lines in the navbar-form that were different from 3.1.1 [it's all in @media (min-width: 768px) so this behavior only shows up on higher resolutions] */ .navbar-form .input-group { display: inline-table; vertical-align: middle; } .navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control { width: auto; /* HERE IS THE CULPRIT */ } /** SOLUTION: in custom CSS **/ /* make sure navbar-form's input-group goes 100% i.e. full width of screen to compliment the display: inline-table; that showed up in 3.2.0 */ .navbar-form .input-group { width: 100%; } /* override width: auto; that showed up in 3.2.0 with at least 1px for the addon or btn (I had an addon) */ .navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn { width: 1px; } /* separate .form-control and give it width: 100%; */ .navbar-form .input-group .form-control { width: 100%; }
原文地址:https://www.jb51.cc/html/232280.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。