什么元素负责垂直居中菜单项

时间:2013-08-29 23:50:24

标签: twitter-bootstrap

我去了twitter bootstrap主页并复制粘贴下面的菜单:

.navbar.navbar-inverse.navbar-fixed-top
  .navbar-inner
    .container / I tried 'margin: 0 auto;' since nav is a display block item but with no luck 
      %button.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse", :type => "button"}
        %span.icon-bar
        %span.icon-bar
        %span.icon-bar
      %a.brand{:href => "./index.html"} Bootstrap
      .nav-collapse.collapse
        %ul.nav
          %li.active
            %a{:href => "./index.html"} Home
          %li
            %a{:href => "./getting-started.html"} Get started
          %li
            %a{:href => "./scaffolding.html"} Scaffolding
          %li
            %a{:href => "./base-css.html"} Base CSS
          %li
            %a{:href => "./components.html"} Components
          %li
            %a{:href => "./javascript.html"} JavaScript
          %li
            %a{:href => "./customize.html"} Customize

BUT!我的物品没有像他们那样居中,我尝试使用safari开发工具,但没有任何运气!

哪个元素负责垂直居中项目?

enter image description here

编辑:这里

enter image description here

编辑:这是我在Safari Tools中看到的.container元素:

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:1)

如果我找到了你,那么它就是具有填充的锚点:10px 15px 10px;那就是它垂直和水平的中心。

答案 1 :(得分:0)

这不是一个集中的问题。菜单项应与导航栏本身的高度相同。 您的导航栏上可能有一个太高的元素。