【问题标题】:Bootstrap navbar floating at the center on Wordpress引导导航栏浮动在 Wordpress 的中心
【发布时间】:2017-01-27 20:01:46
【问题描述】:

我的 Bootstrap 导航栏漂浮在 Wordpress 的中心,不知道为什么。谁能帮我这个?是因为 WordPress 还是我的样式表问题? (如果需要,将在此处更新我的代码)

STYLE.CSS

.navbar-default {
    background: white;
    color: black;
    position: fixed;
}
 .navbar-default .nav li a {
    text-align: center;
}
.navbar-default .nav li a:hover,
.navbar-default .nav li a:focus {
    color: #4aa5df;
    outline: 0;
}
.navbar-default .navbar-nav >.active > a:hover {
    color: #4aa5df;
    background-color: transparent;
}
 .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:focus {
     color: #777;
     background: transparent;
}
.logo {
    width: 190px;
    height: 30px;
}

HEADER.PHP

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header page-scroll">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
    </button>           
</div>
</div>

在我的 html 文件上一切正常,但是当我将它放入 Wordpress 并出现这个问题时!

【问题讨论】:

  • 能否附上相关的html和css?
  • @Passersby 刚刚更新了关于我的问题的代码

标签: php html css wordpress twitter-bootstrap


【解决方案1】:

要将 navbar-default 放在顶部(我假设这是您想要的),您需要:

.navbar-default {
    Position: fixed;
    Top:0;
    Left:0;
    Width:100%;
}

或者,如果您指的是内容,那就是文本对齐有问题! 对不起,我在手机上回复大写!

【讨论】:

  • 我已经尝试过您的答案,但仍然没有运气。导航栏不应该浮动,我希望它是导航栏固定顶部。希望你能帮我解决这个问题:)
猜你喜欢
  • 2016-06-05
  • 1970-01-01
  • 1970-01-01
  • 2017-03-06
  • 1970-01-01
  • 2017-03-30
  • 1970-01-01
  • 2023-03-24
相关资源
最近更新 更多