导航栏无法调整大小以适合手机屏幕

时间:2018-09-08 18:31:12

标签: css mobile bootstrap-4 navbar canjs

这是我的网站https://cleveroscar.github.io./,我想让导航栏适合移动屏幕,以便可以使用,但是在iPhone上测试时,导航栏非常小,请检查开发工具以了解我在说什么,这是下面的代码,我正在使用CanJS支持CSS框架工作的视图和bootstrap 4。

    <div><!-- nav starting div -->
      <nav class="navbar navbar-expand-lg navbar-dark" id="navbg">
        <a class="navbar-brand" href="https://cleveroscar.github.io./">Clever Oscar</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"> </span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav mr-auto">
            <li class="nav-item active ">
              <a class="nav-link" href="#">About <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item ">
              <a class="nav-link" href="#">Projects</a>
            </li>
            <li class="nav-item ">
              <a class="nav-link" href="https://github.com/CleverOscar">Github</a>
            </li>
            <li class="nav-item ">
              <a class="nav-link" href="https://twitter.com/CleverOscarDev">Twitter</a>
            </li>
          </ul>
        </div>
      </nav>
    </div> <!-- nav ending div -->

如果有人愿意,我也有一个git仓库来查看代码

1 个答案:

答案 0 :(得分:1)

您需要的是视口元标记,因此视口会根据您的屏幕尺寸进行缩放
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>