bootstrap 3 - 如何将品牌放在导航栏的中心? [英] bootstrap 3 - how do I place the brand in the center of the navbar?

查看:37
本文介绍了bootstrap 3 - 如何将品牌放在导航栏的中心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Bootstrap 3.我想要一个只有品牌的导航栏.没有其他链接或其他任何东西.我希望品牌处于中心位置.我怎样才能做到这一点?以下 css 不起作用:

.navbar-brand {文本对齐:居中;}

解决方案

css:

.navbar-header {向左飘浮;填充:15px;文本对齐:居中;宽度:100%;}.navbar-brand {float:none;}

html:

</nav>

I am using Bootstrap 3. I would like a navbar with only the brand in it. No other links or anything else. And I want the brand to be in the center. How can I accomplish this? The following css doesn't work:

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

解决方案

css:

.navbar-header {
    float: left;
    padding: 15px;
    text-align: center;
    width: 100%;
}
.navbar-brand {float:none;}

html:

<nav class="navbar navbar-default" role="navigation">
  <div class="navbar-header">
    <a class="navbar-brand" href="#">Brand</a>
  </div>
</nav>

这篇关于bootstrap 3 - 如何将品牌放在导航栏的中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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