gpt4 book ai didi

html - Bootstrap 3 : Navbar doesnt collapse into hamburguer menu when screen is shrinked

转载 作者:行者123 更新时间:2023-11-28 05:22:44 25 4
gpt4 key购买 nike

我正在使用 Bootstrap 3,由于某些原因,当我缩小屏幕时,我的 navbar 菜单没有折叠到“汉堡包”菜单中。

我已经检查过我已经包含了 JQuery 以及 Bootstrap Javascript 和 CSS 文件。控制台也没有抛出任何错误。

这是我的代码:

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>My Site</title>

<script src="https://code.jquery.com/jquery-2.2.2.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Yesteryear' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="css/thumbnail-gallery.css" rel="stylesheet">

</head>

<body style="background-color:#F0F0F0;">


<nav class="navbar" role="navigation">
<div class="container">

<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html" style="font-family:YesterYear; font-size:2.9em;">MY SITE</a>
</div>

<div class="collapse navbar-collapse pull-right" id="bs-example-navbar-collapse-1" style="font-size:1.5em;" >
<ul class="nav navbar-nav">
<li>
<a href="#" target="blank"><i class="fa fa-twitter"></i></a>
</li>
<li>
<a href="#"><i class="fa fa-envelope"></i></a>
</li>
<li>
<a href="#" target="blank"><i class="fa fa-facebook"></i></a>
</li>
<li>
<a href="#" target="blank"><i class="fa fa-instagram"></i></a>
</li>
</ul>
</div>

</div>

</nav>

知道我遗漏了什么或做错了什么吗?

最佳答案

您忘记为导航栏指定样式。更改 <nav class="navbar" role="navigation"><nav class="navbar navbar-default" role="navigation"> .它将为您创建汉堡菜单。然后,您必须设置导航栏的样式。

关于html - Bootstrap 3 : Navbar doesnt collapse into hamburguer menu when screen is shrinked,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36371318/

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