如何在带有引导程序的导航中放置一个glyphicon?

时间:2016-10-12 18:30:24

标签: html css twitter-bootstrap nav glyphicons

我想做这样的导航:

标志:::::::: | :::::下拉+搜索(中心)::::: | :::::::::: Glyphcon1Glyphcon2 |

在这一刻我做了这个,但是glyphcon显示了导航内容。

Actual nav picture



<nav class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse"
                data-target=".navbar-ex1-collapse">
            <span class="sr-only">Desplegar navegación</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">Logotipo</a>
    </div>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
        <div class="input-group navbar-form navbar-center">
            <div class="input-group-btn">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action <span class="caret"></span></button>
                <ul class="dropdown-menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li role="separator" class="divider"></li>
                    <li><a href="#">Separated link</a></li>
                </ul>
            </div><!-- /btn-group -->
            <input type="text" class="form-control" aria-label="...">
        </div><!-- /input-group -->
        <ul class="nav navbar-nav navbar-right">
            <li><span class="glyphicon glyphicon-user"></span></li>  
            <li><span class="glyphicon glyphicon-shopping-cart"></span></li>
        </ul>
    </div>
</nav>
&#13;
&#13;
&#13;

如何将下拉列表+搜索放在导航器的中心,并将glyphcon放在同一行中而不会出现问题?

1 个答案:

答案 0 :(得分:0)

$group占据整行,所以下一行id会转到下一行的右侧。解决这个问题,将<div class="input-group navbar-form navbar-center">置于其他<div class="nav navbar-right navbar-nav">

在元素<div class="input-group navbar-form navbar-center">中,您在<div class="nav navbar-nav navbar-left">标记中包含两个图标,它们类似于文字,但是当您在nav navbar-nav navbar-right标记a / c中包含图标以引导<li></li>时1}}标记它填充在<a href="#"></a>类中。

<a>