html - 我如何让 Navbar 居中?

标签 html css bulma

我之前看过这里,但没有任何效果。 我正在使用 Bulma Framework,我认为这是闻所未闻的,但我希望你能帮助我将品牌链接放在导航栏的中心。这就是我现在拥有的:

.navbar {
  background-color: #0a0a0a;
  color: white;
  height: 9%;
}

.navbar .navbar-brand > .navbar-item,
.navbar .navbar-brand .navbar-link {
  color: white;
  font-family: 'Wavehaus';
}

我在 Codepen 上有一个链接,这样它就可以可视化了:

https://codepen.io/anon/pen/BwrWwg

请注意,字体不会显示。

最佳答案

您只需要为 navbar 设置正确的 display。目前,Bulma 使用 Flex Layout。现在清除 flex 并使其使用 block 将使其工作:

.navbar .navbar-brand {
  text-align: center;
  display: block;
  width: 100%;
}

.navbar .navbar-brand > .navbar-item,
.navbar .navbar-brand .navbar-link {
  display: inline-block;
}

关于html - 我如何让 Navbar 居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46635215/

相关文章:

html - 导航栏和英雄颜色被背景颜色隐藏

javascript - 单击按钮时隐藏 JQuery css

javascript - 在html表中获取倒数第二个 child td

html - 响应式表单 - 控制文本区域的高度

html - 如何在 Bulma 框架中将一个元素居中放置在一个 tile 中

bulma - 从 Bulma SASS 中删除未使用的颜色

javascript - HTML Canvas 文本输入和退格键

带有引用文本的 href 的 HTML 链接?

html - 中间带有 Logo 的导航栏

jQuery UI 滑动效果问题