Facing a problem with navbar

I’m currently doing the second front end development project. I am facing a problem with the navigation bar.


As you can see, the burger icon does not seem to get centered on the navbar. But when I set the image height to 30px it does.(previously it was 40px )

But I want to keep the height 40px and center the icon. How do I do that?
Here is the pen:

Since your navbar is using a display: flex property, simply adding a

justify-content: center should do the trick.

Hope it helps :+1:

1 Like

Where do I put this?

anywhere that your navbar see it:

so far in your project your nav is:

<nav class="navbar navbar-toggleable-sm navbar-light" 
 style="background-color:purple;"
>

so you can add it to the navbar class for example:

//css
.navbar {
 justify-content: center
}

or straight inline in style:

style="background-color:purple; justify-content: center"

Up to you and where you thinks makes more sense project-wise

1 Like

But I have encountered another problem. When I click on the burger icon this happens:


What do I do about this?

Even according to Bootstrap documentation:

Adding images to the .navbar-brand will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate.

So you likely have to play around with the image positioning. Even in their examples they always give the img brand a 30px width and height, it’s probably due to how big is the navbar by default.

My best bet if you want to achieve a custom width/positioning of the image is by wrapping the content of the navbar inside rows and column (grid systems) and work your positioning that way :slight_smile:

Thank you very much. I’ll give it a try.