Changing class from navbar-light to navbar-dark hides navbar
You also need to add the class bg-dark
additionally to navbar-dark
.
navbar-dark
basically just determines what color the text should be i.e. light text for a dark-background navbar and dark text for a light-colored navbar.
bg-dark
then determines the actual background-color of the navbar. But other colors would work just as well. For example, bg-primary
or bg-danger
would work well with navbar-dark
.
Related videos on Youtube
PhotoJorie
Updated on June 04, 2022Comments
-
PhotoJorie almost 2 years
I am building a website using Laravel and the Bootstrap CSS framework. I have a navbar at the top of the page which is used for navigating across different pages. By default, the Laravel set the navbar class to
navbar-light
. Since I don't want the navbar to be white, I changed it tonavbar-dark
. When I do this, all the content from navbar disappears, there remains only white bar without any content. What am I doing wrong?<nav class="navbar navbar-expand-md navbar-dark navbar-laravel" style="margin-bottom: 20px;"> <div class="container"> <a class="navbar-brand" href="{{ url('/') }}"> {{ config('app.name', 'Laravel') }} </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <!-- Left Side Of Navbar --> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="#">Messages <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="#">People <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="#">Photos <span class="sr-only">(current)</span></a> </li> </ul> <!-- Right Side Of Navbar --> <ul class="navbar-nav ml-auto"> <!-- Authentication Links --> @guest <li><a class="nav-link" href="{{ route('login') }}">Login</a></li> <li><a class="nav-link" href="{{ route('register') }}">Register</a></li> @else <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{ Auth::user()->name }} <span class="caret"></span> </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="dashboard"> Dashboard </a> <a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"> Logout </a> <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;"> @csrf </form> </div> </li> @endguest </ul> </div> </div> </nav>
-
Gerardo BLANCO about 6 yearsWelcome to Stack Overflow! Questions seeking debugging help should include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it within the question itself. Questions without a clear problem statement are not useful to other readers. Please see: How to create a Minimal, Complete, and Verifiable example.
-
Hackerman about 6 yearsWhich version of Bootstrap?
-
PhotoJorie about 6 yearsIf I open public/css/app.css, it says that the version is 4.0.0 at the top of the file (in the comment section).
-