I am working on a navbar that was made out of HTML CSS and Bootstrap. I had followed some tutorials on youtube but I can seem to expand the toggle button when the screen size is reduced to the smallest. Since I'm starting a new project, I applied all of this with HTML CSS, and Bootstrap and opened the HTML file in my local directory.
<!doctype html>
<html lang="fa" dir="rtl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="asset/css/bootstrap.min.css">
<!--<link rel="stylesheet" href="asset/css/bootstrap-rtl.min.css">-->
<link rel="stylesheet" href="asset/css/style.css">
<!--<link rel="stylesheet" href="asset/fontawesome/css/all.min.css">-->
<title>فروشگاه</title>
</head>
<body class="bg-success">
<header>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">خشکبار</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav justify-content-center">
<li class="nav-item active">
<a class="nav-link" href="#">صفحع اصلی</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">درباره ما</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">فروشگاه</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">اخبار</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">راهنمای خرید</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">تماس با ما</a>
</li>
</ul>
</div>
</nav>
</div>
</header>
<script src="asset/js/jquery-3.5.1.min.js"></script>
<script src="asset/js/bootstrap.bundle.min.js"></script>
<script src="asset/js/popper.min.js"></script>
<script src="asset/js/bootstrap.min.js"></script>
</body>
</html>
I created a codeply for you, there is no error in your code, you just need to add a few <script>
s into your code. I recommend you to use the cdn
.
In order to make the hamburger button work, the necessary lines of code are needed:
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
</head>
<body>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
</body>
Make sure you include these lines of code in this specific order.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments