douqi3913 2015-01-16 12:45
浏览 38
已采纳

为什么我的引导程序导航样式在访问移动网站时丢失了

At the top of my website I have included a standard, fixed-top bootstrap navbar and have not added any other CSS on top of the bootstrap default. Even with this I find that when shrinking the window to mobile (below 767px) the styling goes crappy. A margin is added at the top and bottom of the buttons and as you go smaller the about button on the right goes completely out of alignment. Does anyone know a fix for this. I have tried just going and tweaking the css to fix the problem but with no success.

Here is the code for the navbar:

    <?php 

    $pg = pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME);

    if ($pg == "index") {
      $navbarposition = "navbar-fixed-bottom";
    } else {
      $navbarposition = "navbar-fixed-top";
    }

    echo "<body>";
    echo "<nav class='navbar navbar-default " . $navbarposition . " navbar-inverse' role='navigation'>"

    ?>
        <ul class="nav navbar-nav">
            <li id="about" <?php if($pg == 'about'){echo 'class="active"';} ?> ><a href="about.php">About</a></li>
            <li id="staff" <?php if($pg == 'staff'){echo 'class="active"';} ?> ><a href="staff.php">Staff</a></li>
            <li id="contact" <?php if($pg == 'contact'){echo 'class="active"';} ?> ><a href="contact.php">Contact</a></li>
            <li id="calendar" <?php if($pg == 'calendar'){echo 'class="active"';} ?> ><a href="calendar.php">Calendar</a></li>
        </ul>
    </nav>
    </body>

Thanks

Kabeer

  • 写回答

1条回答 默认 最新

  • douyan8413 2015-01-16 14:09
    关注

    Finally found a solution to my problem. For anyone else who finds this in the future just download a customised version of bootstrap from this page: http://getbootstrap.com/customize and set @grid-float-breakpoint variable to 1px.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改
  • ¥15 Windows 系统cmd后提示“加载用户设置时遇到错误”
  • ¥50 vue router 动态路由问题
  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义