Nhabbott Nhabbott - 11 months ago 114
CSS Question

Bootstrap dropdown styles weird on dropdown

Below is a picture showing what happens when I click my bootstrap dropdown. I'm not sure why bootstrap doesn't darken the small area underneath, maybe my CSS for the image but I highly doubt it. Below the picture you can find the navbar code & CSS for the image. Here is a JSFiddle.

Weird Bootstrap Dropdown

Navbar Code

<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>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="login"><img class="navbar-avatar" src="{{ asset('src/img/login_steam.png') }}"></a></li>
<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>

Avatar CSS

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


You just need to adjust the padding of the dropdown link to your needs

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