I looked on here before, but nothing really worked. I am using Bulma Framework which I believe is relatively unheard of, yet I was hoping you could help me center the brand link on the navbar. This is what I have it at right now:
.navbar {
background-color: #0a0a0a;
color: white;
height: 9%;
}
.navbar .navbar-brand > .navbar-item,
.navbar .navbar-brand .navbar-link {
color: white;
font-family: 'Wavehaus';
}
I have a link on Codepen so that it can be visualized:
https://codepen.io/anon/pen/BwrWwg
Note that the font will not show up.
The key is to place the logo image in the first <li> element of your list. You then display all the elements of the list as inline and use vertical-align: middle to line them up. You can adjust the padding and margin properties to get the exact look that you need.
You can do this by setting the display property to "flex." Then define the align-items and justify-content property to “center.” This will tell the browser to center the flex item (the div within the div) vertically and horizontally.
Suppose you have four items in your navigation menu–you can work out the width of these and use margin:0 auto; to centre them. Adding a fifth will increase the width, meaning you'd need to alter the CSS, too.
You just need to set the right display
for the navbar
. Currently, Bulma makes use of Flex Layout. Now clearing the flex and making it use block
will make it work:
.navbar .navbar-brand {
text-align: center;
display: block;
width: 100%;
}
.navbar .navbar-brand > .navbar-item,
.navbar .navbar-brand .navbar-link {
display: inline-block;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With