Table of Contents
- The top navigation menu bar is created easily with Bootstrap. Generally, the menu is aligned to the left or right side of the highest navigation bar. Bootstrap provides a simple thanks to control the menu alignment. To align the text or menu links in Bootstrap navbar, navbar-nav and navbar-left or navbar-right are used.
- However, sometimes it requires aligning menu links within the center of the navbar. But Bootstrap doesn’t have any class for center alignment. During this tutorial, we’ll show how you’ll change the position of menu or text to center within the Bootstrap navbar.
- The Bootstrap libraries need to be included first to make navigation bar with Bootstrap.
HTML Code
The following HTML creates a navbar with Bootstrap. The menu is going to be placed in three different positions, left, right, and center. Add the custom defined class named navbar-center to align menu center.
CSS Code
The following CSS code of the navbar-center class will align the menu or text content to the middle position in Bootstrap navbar.
Our example code aligns the menu in three positions on Bootstrap navbar just like the below.