Bootstrap 中心导航栏项目 [英] Bootstrap Center Navbar Items

查看:31
本文介绍了Bootstrap 中心导航栏项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以向左和向右推动导航栏项目,但我如何将它们居中?

I know I can push navbar items to the left and right, but how would I center them?

text-align:center;

不起作用,也没有我想到的任何其他事情.

doesn't work nor any of the other things I thought of.

推荐答案

您需要修改 Navbar 组件的一些 CSS 规则.因此,在 nav.navbar 中添加一个类 center 和以下规则:

You will need to modify some CSS rules for Navbar component. So add a class center to nav.navbar and the following rules:

.navbar.center .navbar-inner {
    text-align: center;
}

.navbar.center .navbar-inner .nav {
    display:inline-block;
    float: none;
}

工作演示(Bootstrap 3.3.7)

这篇关于Bootstrap 中心导航栏项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆