Home >Web Front-end >CSS Tutorial >How Do I Create a Two-Row Navbar Using Bootstrap 4?
In this Bootstrap 4 tutorial, we'll show you how to create a navbar with two rows. This is a common design pattern for websites that have a lot of navigation options or want to separate different types of navigation.
To follow along, you'll need:
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="#">Navbar</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">
To add two rows to the navbar, we'll use the flex-column class on the navbar-collapse div. This will cause the child elements of the navbar-collapse div to stack vertically.
<div class="collapse navbar-collapse flex-column">
Now that we have two rows, we can add the navigation links to them. We'll create two ul elements, one for each row.
<div class="collapse navbar-collapse flex-column">
Here is the resulting navbar with two rows:
The above is the detailed content of How Do I Create a Two-Row Navbar Using Bootstrap 4?. For more information, please follow other related articles on the PHP Chinese website!