如何增加navbar-form中文本框的宽度

时间:2015-02-18 17:48:21

标签: html css twitter-bootstrap

我目前在导航栏中创建了我的搜索框,如下所示:

<div class="col-sm-3 col-md-3 col-lg-5">
     <div class="navbar-form" role="search">
         <div class="input-group">
             <asp:TextBox ID="TextBoxSearch" CssClass="form-control" placeholder="Search" runat="server"></asp:TextBox>
             <div class="input-group-btn">
                 <asp:LinkButton ID="LinkButtonSearch" CssClass="btn btn-default" OnClick="search_click" runat="server"><i class="glyphicon glyphicon-search"></i></asp:LinkButton>
            </div>
        </div>
    </div>
</div>

此方法给出以下结果: http://i.imgur.com/tPDQ8PC.png

但是,我希望在&#34;添加网站&#34;之间扩展搜索框。和&#34;注册&#34;并居中,每边留下约20px的边距。出于某种原因navbar-form不允许宽度增长超过某一点。我该怎么做才能解决这个问题?我删除navbar-form并替换为例如form-group时,格式和上边距和下边距都是错误的。

编辑:Navbar代码:

<div class="navbar navbar-inverse navbar-static-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a href="/Default.aspx" class="navbar-brand">Logogo</a>

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <nav class="collapse navbar-collapse" role="navigation">

                    <ul class="nav navbar-nav navbar-left">
                        <li><a href="/Default.aspx">Home</a></li>
                        <li><a href="/AddSite.aspx">Add a website</a></li>
                    </ul>

                    <div class="col-sm-3 col-md-3 col-lg-5">
                        <div class="navbar-form" role="search">
                            <div class="input-group">
                                <asp:TextBox ID="TextBoxSearch" CssClass="form-control" placeholder="Search" runat="server"></asp:TextBox>
                                <div class="input-group-btn">
                                    <asp:LinkButton ID="LinkButtonSearch" CssClass="btn btn-default" OnClick="search_click" runat="server"><i class="glyphicon glyphicon-search"></i></asp:LinkButton>
                                </div>
                            </div>
                        </div>
                    </div>

                    <ul class="nav navbar-nav navbar-right">
                        <li >
                            <asp:LinkButton ID="LinkButtonRegister" runat="server" OnClick="Register">Register</asp:LinkButton></li>
                        <li>
                            <asp:LinkButton ID="LinkButtonLogin" data-toggle="modal" data-target="#loginModal" runat="server">Log in</asp:LinkButton></li>
                        <li>
                            <asp:LinkButton ID="LinkButtonLogout" runat="server" OnClick="Logout">Log out</asp:LinkButton></li>
                    </ul>
                </nav>
            </div>
        </div>

0 个答案:

没有答案