本文介绍了Bootstrap 3 - 如何最大化navbar内的输入宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我有一个导航栏,如下所示:
Right now I have a navigation bar that looks like:http://bootply.com/78239
我想最大化搜索文本输入的宽度,而不创建换行符(即,清除链接将与关于链接紧密相连)。
I want to maximize the width of the "search" text-input, without creating line-breaks (i.e., that the "Clear" link will be tight with the "About" link).
我只有css和网页设计的基本经验。我读了一些关于
- Drop the float left of the form (by dropping the navbar-left class)
- Give other navbar elements a right float (the navbar-right class)
- Set display of the form-group to inline (style="display:inline")
- Change the position of the elements (the right floated first)
相关问题:
- Expand div to max width when float:left is set
html ::
html:
<div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">My Project</a> </div> <div class="navbar-collapse collapse" id="searchbar"> <ul class="nav navbar-nav navbar-right"> <li><a href="about.html">About</a></li> <li id="userPage"> <a href="#@userpage"><i class="icon-user"></i> My Page</a> </li> <li><a href="#logout" data-prevent="">Logout</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="#" title="Start a new search">Clear</a></li> </ul> <form class="navbar-form"> <div class="form-group" style="display:inline;"> <div class="input-group"> <span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span> <input class="form-control" name="search" placeholder="Search Here" autocomplete="off" autofocus="autofocus" type="text"> </div> </div> </form> </div><!--/.nav-collapse --> </div> </div>
这篇关于Bootstrap 3 - 如何最大化navbar内的输入宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!