Welcome to my stretched Bulma navigation tutorial. For those of you that don’t know. Bulma is an incredibly easy to use free and open source CSS Framework built on the latest CSS flexbox features. Bulma comes with many components, such as a navigation bar and elements like tooltips and buttons which can be customised to suit your needs. Furthermore, it is modular, allowing you to use as many or little features that you require.
Generally, developers use CSS frameworks because they are flexible and easy to use. Projects can be done so much quicker in this world where people want things done yesterday. I have also extended a NavWalker so Bulma can be easily integrated into a WordPress theme.
Now back to this tutorial. Like many frameworks, the Bulma navbar component has support for Navigation items to be either on the left (.navbar-start) or the right (.navbar-end) classes. During the redesign of my blog earlier in the year, I wanted to change to a stretched Bulma navigation which spans items evenly across the top. It didn’t take long to discover that it can be done with the power of Flexbox.
You need to include the latest version of Bulma in your project. Currently, it has been tested on 0.74 and 0.75. This can be done by either including the production CSS file into your project or my preferred method would be to use NPM and node-sass to build Bulma.
Setting up the NavBar
As you can see I have only made 1 small change to the HTML code. Where you would normally have either the
.navbar-end classes I have added
.navbar-center instead. In the CSS code, I have only enabled the navigation bar to display on screen widths a minimum of 1088px allowing the navigation to remain the default on smaller displays. This can, however, be changed to suit your individual needs.
Demo & Download
Please note: The CodePen demo works best in full-screen mode, which allows you to see the stretched navigation.