导航栏链接在较小的屏幕上重叠

时间:2018-09-06 18:44:02

标签: html css

所以我的网站出现了这个问题,导航栏上的链接开始以某个窗口大小重叠,在移动设备上看起来真的很糟糕。以下是导航栏的HTML,我想知道是否有一种方法可以设置导航栏的大小,以便人们可以向左或向右滚动。

<div class="navbar-fixed" style="position: fixed; top: 0; left: 0;width: 100%;">
  <nav>
    <div class="nav-wrapper white">
      <a href="index.html" class="brand-logo" style="position: fixed; top: 0; left: 0;"><img src="images/headerlogo.png" class="valign-wrapper"></a>
      <ul class="right">
        <li><a href="aboutus.html"><span style="color:#CF5300"><span style="font-family: 'Graduate', cursive">About Us</span></span></a></li>
        <li><a href="traditions.html"><span style="color:#CF5300"><span style="font-family: 'Graduate', cursive">Traditions</span></span></a></li>
        <li><a href="letters.html"><span style="color:#CF5300"><span style="font-family: 'Graduate', cursive">Letters</span></span></a></li>
        <li><a href="photos.html"><span style="color:#CF5300"><span style="font-family: 'Graduate', cursive">Photos</span></span></a></li>
        <li><a href="contactus.html"><span style="color:#CF5300"><span style="font-family: 'Graduate', cursive">Contact Us</span></span></a></li>
        <li><a href="https://www.facebook.com/longhornhellraisers/"><img src="images/facebook.png"></a></li>
        <li><a href="https://twitter.com/hellraisers1988?lang=en"><img src="images/twitter.png"></a></li>
        <li><a href="https://www.instagram.com/longhornhellraisers/?hl=en"><img src="images/instagram.png"></a></li>
      </ul>
    </div>
  </nav>
</div>

1 个答案:

答案 0 :(得分:0)

在引导程序中,您使用的是普通导航栏。使用导航栏折叠使其可移动响应

 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  
  <nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Page 1-1</a></li>
            <li><a href="#">Page 1-2</a></li>
            <li><a href="#">Page 1-3</a></li>
          </ul>
        </li>
        <li><a href="#">Page 2</a></li>
        <li><a href="#">Page 3</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
        <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
      </ul>
    </div>
  </div>
</nav>