0

嗨,我正在为我的 asp.net Web 应用程序使用引导样式,并且顶部有一个菜单控件。我想在菜单栏的同一行的右上角插入一个搜索文本框。以下是我的代码。谁能建议如何做到这一点?谢谢。

<div id="container">
    <form runat="server" class="navbar-form navbar-left" role="search">
    <div class = "navbar">          

        <div class="navbar-inner">
            <div class="container">
             <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
                <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>

                <div class="nav-collapse collapse">
                    <asp:Menu ID="NavigationMenu" runat="server" EnableViewState="false"
                        IncludeStyleBlock="false" Orientation="Horizontal"
                        CssClass="navbar"
                        StaticMenuStyle-CssClass="nav"
                        StaticSelectedStyle-CssClass="active"
                        DynamicMenuStyle-CssClass="dropdown-menu">
                        <Items>
                            <asp:MenuItem Text="Home" ToolTip="Home"></asp:MenuItem>
                            <asp:MenuItem Text="Music" ToolTip="Music">
                                <asp:MenuItem Text="Classical" ToolTip="Classical" />
                                <asp:MenuItem Text="Rock" ToolTip="Rock" />
                                <asp:MenuItem Text="Jazz" ToolTip="Jazz" />
                            </asp:MenuItem>
                            <asp:MenuItem Text="Movies" ToolTip="Movies">
                                <asp:MenuItem Text="Action" ToolTip="Action" />
                                <asp:MenuItem Text="Drama" ToolTip="Drama" />
                                <asp:MenuItem Text="Musical" ToolTip="Musical" />
                            </asp:MenuItem>
                        </Items>
                    </asp:Menu>

          <div class="form-group">
            <input type="text" class="form-control" placeholder="Search"/>
        <button type="submit" class="btn btn-default">Submit</button>
          </div>    
          </div>                
            </div>          
        </div>
    </div>          
    </form>
    </div>
    `

菜单对齐

4

1 回答 1

0

尝试添加navbar-right类。

<div class="form-group" class="navbar-right">
于 2013-11-12T03:50:17.603 回答