使用Bootstrap我的导航栏在移动设备上太长了

时间:2018-12-06 21:18:18

标签: html css bootstrap-4 navbar nav

我在https://bjmrq.github.io/foyer.html网站上的代码有点麻烦,在笔记本电脑上一切都很好,但是一旦我用手机检查一下,导航栏似乎太长了!如果有人可以帮助我:)(我正在使用引导程序4) 谢谢您的宝贵时间!

<nav id="mainNavbar" class="navbar navbar-dark navbar-expand-sm fixed-top" style="background-color: #563d7c;">
<a class="navbar-brand navTitle mx-2" href="index.html"><span class="fas fa-camera-retro"></span>&nbsp; Sophie Madonna</a>
<button class="navbar-toggler" data-toggle="collapse" data-target="#navLinks" aria-label="Toggle navigation">
  <span class="navbar-toggle``r-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navLinks">
  <ul class="navbar-nav">
    <li class="nav-item mx-2">
      <a class="navbar navTitle nav-link" href="foyer.html"><span class="fab fa-gripfire"></span>&nbsp; Le foyer</a>
    </li>
  </ul>
  <ul class="navbar-nav ml-auto">
    <li class="nav-item mx-2">
      <a href="about.html" class="nav-link">My Story</a>
    </li>
    <li class="nav-item mx-2">
      <a href="contact.html" class="nav-link">Follow Me</a>
    </li>
  </ul>
</div>

.navbar {
font-family: 'Ranga';
color: white;
font-size: 1.3em;
}

.navbar-light .navbar-brand .navbar-nav .nav-link .navTitle .navbar .navbar-dark {
font-family: 'Ranga';
color: white;
font-size: 1.3em;
}

here is my problem

2 个答案:

答案 0 :(得分:0)

第一个<hr>标签下方的<h1>元素具有设定的宽度width: 500px;,这导致身体的其余部分在较小的屏幕上向左推。

答案 1 :(得分:0)

为图像使用类 img-fluid

<div class="col-md-5 col-lg-5 col-12 col-sm-12">
<div class="heading-text">
<img src="/images/1/undraw_uploading_go67.svg" class="img-fluid" alt="">
</div>
</div>