Home>Article>Web Front-end> How to center the bootstrap navigation bar

How to center the bootstrap navigation bar

(*-*)浩
(*-*)浩 Original
2019-07-17 09:43:18 6428browse

When I used Bootstrap to practice imitating a website today, I found that the menu in the navigation bar of the target website is centered. However, Bootstrap does not seem to have a centered style for the navigation menu. It took me a long time and many tests to finally find a solution.

How to center the bootstrap navigation bar

The first method: add the following styles to div and ul:(recommended learning:Bootstrap video tutorial)

Second method:

Add the following style:

.navbar-nav { float: none; text-align:center; } ul.nav.navbar-nav li { float:none; display: inline-block; margin: 0em; }

More Bootstrap related technical articles, Please visit theBootstrap Tutorialcolumn to learn!

The above is the detailed content of How to center the bootstrap navigation bar. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn