下拉列表中的Bootstrap下拉样式很奇怪

时间:2016-07-22 02:03:43

标签: html css twitter-bootstrap blade

下面的图片显示了点击我的引导下拉列表时会发生什么。我不确定为什么bootstrap不会使下面的小区域变暗,也许我的CSS用于图像,但我非常怀疑它。在图片下方,您可以找到导航条代码&图像的CSS。这是JSFiddle

Weird Bootstrap Dropdown

Navbar代码

<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">
                @if(!Auth::check())
                    <li><a href="login"><img class="navbar-avatar" src="{{ asset('src/img/login_steam.png') }}"></a></li>
                @else
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><span>{{ Auth::user()->username }}</span><img class="navbar-avatar" src="{{ Auth::user()->avatar }}"></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">Dashboard</a></li>
                            <li><a href="#">Settings</a></li>
                            <li><a href="#">Logout</a></li>
                         </ul>
                    </li>
                @endif
            </ul>
        </div>
    </div>
</nav>

头像CSS

.navbar-avatar {
width: 45px;
height: 45px;
position: relative;
float: right;
top: -10px;
margin-left: 8px;
}

1 个答案:

答案 0 :(得分:1)

您只需根据需要调整下拉链接的填充

.navbar-nav > li > a {
    padding-top: 15px;
    padding-bottom: 25px;
}

Jsfiddle