naspy971's avatar

Bootstrap navbar messed up in Laravel 5.6

Hi, that's kind of weird but my subject was originally on stackoverflow and just realised the best idea would have been laracasts so here's the subject :

https://stackoverflow.com/questions/48951572/bootstrap-navbar-messed-up-in-laravel-5-6

Also we can't upload images and format code in this forum which is pretty annoying in my opinion.

Well, I must add onto the subject that bootstrap works wonders in Laravel 5.5, but the last version completely fails.

Whats the issue so ?

Thanks

0 likes
6 replies
elvijs's avatar

Try to compile your assets by executing npm run dev. Also check the source code of the page you're visiting and ensure that the css/app.css file is referenced.

WW's avatar

I've had similar problem with latest bootstrap and Laravel. If I understood correctly, it forces light background for the navbar.

Try using these classes for the nav element

<nav class="navbar fixed-top navbar-expand-md navbar-dark bg-dark">

If it doesn't help, go to your resources/assets/sass/_variables.scss, and adjust navbar styles.

Don't forget to run npm run dev if you are working with scss.

Hope that helps!

1 like
Snapey's avatar
protected function thatSucks($not)
{
    return "misconception";
}
ejdelmonico's avatar

You appear to be using Bootstrap 3.3 markup for the navbar. Even if not, your branding link is in the wrong child position and I believe its navbar-dark.

<nav class="navbar navbar-dark bg-dark">
  <a class="navbar-brand" href="#">Project name</a>
  <!-- Navbar content -->
</nav>
1 like
naspy971's avatar

Thanks everyone, Yes actually I'm using a bootstrap 3 template and Laravel 5.6 uses bootstrap 4 and obviously some classes have radically changed.

Issue resolved.

3 likes

Please or to participate in this conversation.