gpt4 book ai didi

html - 手机上的导航菜单很古怪?

转载 作者:太空宇宙 更新时间:2023-11-04 07:35:57 25 4
gpt4 key购买 nike

我正在尝试简化我客户网站背后的代码,因为有一些无关的代码。执行此操作时,导航菜单( Bootstrap )不再有效?它似乎不在屏幕上,我不确定为什么或如何修复它。

<div id="container-para" class="container-fluid">
<nav class="navbar navbar-default navbar-toggleable-md navbar-expand-lg navbar-inverse bg-inverse justify-content-around fixed-top" >
<a class="navbar-brand" href="/">
<img src="/inc/img/IMG_1877.jpg" alt="Cheapest Used Tires" style="padding-right:1px;border-radius: 6%;"><span>Cheapest Used Tires</span></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<img class="logo3" src="/inc/img/3logo.jpg">
</button>

<div class="collapse navbar-collapse" id="navbarNavAltMarkup">

<ul class="navbar-nav navbar-justify text-center">

<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dealersDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="logo3" src="/inc/img/3logo.jpg">
Tire Dealers</a>
<div class="dropdown-menu" aria-labelledby="dealersDropdown">
<a class="dropdown-item" href="/tire-dealers.php">Tire Dealers</a>
<a class="dropdown-item" href="/construction.php">Tire Services</a>
<a class="dropdown-item" href="/construction.php">All Auto Services</a>
</div>
</li>

<li class="nav-item">
<a class="nav-link" href="/construction.php">Why Used?</a>
</li>

<li class="nav-item">
<a class="nav-link" href="/construction.php">Tire Science</a>
</li>

<li class="nav-item">
<a class="nav-link" href="/construction.php">Tire Products</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/NewPages/contact.php">Contact Us</a>
</li>
<li class="nav-item">
<form method="post" action="/auth/user/users.php">
<button class="nav-item nav-link buttons">Login or Join</button>
</form>
</li>
</ul>
</div>
</nav>

https://jsfiddle.net/j3rfkrgc/2/

最佳答案

的确,Bootstrap 3 代码不能与 Bootstrap 4 css 一起工作。 Bootstrap 4 几乎是对 Bootstrap 3 的完全重写。因此,几乎所有内容都发生了变化

这是工作中的 Bootstrap 4 导航栏的样子:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</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="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>

注意:没有navbar-defaultnavbar-toggleable-* 类开始。此外,保持 HTML 有效是个好主意。 (有些不是)

Bootstrap 4 导航栏引用:

https://getbootstrap.com/docs/4.0/components/navbar/

关于html - 手机上的导航菜单很古怪?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48956993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com