The collapsible navbar feature is malfunctioning and the navbar-toggle button is not responsive

Whenever I reduce the size of my browser, the collapsible navbar in Bootstrap is not visible.

This is the code for my webpage: index.html

<!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 Webpage</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/styles.css">
    <link href="https://fonts.googleapis.com/css2?family=Oxygen:wght@300;400;700&display=swap" 
      rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Lora&display=swap" rel="stylesheet">
</head>
<body>
<header>
    <nav id="header-nav" class="navbar navbar-default">
        <div class="container">
            <div class="navbar-header"> <!--wrapper class-->
                <a href="index.html" class="float-left d-none d-md-block">
                    <div id="logo-img" alt="Logo image"></div>
                </a>
                <div class="navbar-brand">
                    <a href="index.html"><h1>Website Name</h1></a>
                    <p>
                        <img src="https://img.icons8.com/cotton/64/000000/star.png" alt="Kosher 
                          Certification">
                          <span>Certified</span>
                    </p>
                </div>
                <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data- 
                     target="#collapsable-nav" aria-expanded="false">
                     <span class="sr-only">Toggle navigation</span>
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                </button>
            </div>
       </div>
</nav>


</header>
     <!-- jQuery (Bootstrap JS plugins depend on it) -->
     <script src="js/jquery-3.5.1.min.js"></script>
     <script src="js/bootstrap.min.js"></script>
     <script src="js/script.js"></script>
 </body>
</html>

styles.css

 body{
    font-size: 16px;
    color: #fff;
    background-color:#61122f;
    font-family: 'Oxygen', sans-serif;
}

#header-nav{
    background-color: #f6b319;
    border-radius: 0;
    border: 0;
}

#logo-img{
    background:url("rest.png") no-repeat;
    width: 175px;
    height: 175px;
    margin:10px;

}

.navbar-brand{
    padding-top: 25px;
}

.navbar-brand h1{
    font-family: 'Lora', serif;
    color: #557c3e;
    font-size: 1.5em;
    text-transform: uppercase;
    font-weight: bold;
    text-shadow: 1px 1px 1px #222;
    margin-top: 0;
    margin-bottom: 0;
    line-height: .75
}
.navbar-brand a:hover, .navbar-brand a:focus {
    text-decoration: none;
}
.navbar-brand p{ 
    color: #000;
    text-transform: uppercase;
    font-size: .7em;
    margin-top: 15px;
}

Upon reducing the page size, the output on the browser looks like this: Browser Output

A small button appears instead of the collapsible navbar. What could be causing this issue?

Answer №1

Start building your website with this basic template and customize it to fit your needs.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8>;
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" crossorigin="anonymous">
<style>
header, .navbar { background: pink; }
#logo-img { width: 20vw; height: 20vw; border: 1px solid orange; }
.navbar-brand h1 span:first-child { font-size: 1.25rem; }
</style>
<title>My Website</title>
</head>
<body>
<header>
<nav id="header-nav" class="navbar navbar-expand-md navbar-light">
  <div class="container">
    <a href="index.html" class="d-none d-md-inline-block mr-4">
      <div id="logo-img" alt="Logo"></div>
    </a>
    <div class="navbar-brand">
      <a href="index.html">
        <h1 class="mb-3"><span class="d-md-none">Website Name</span>
          <span class="d-none d-md-block">Website Name</span></h1>
      </a>
    </div>
    <p class="d-none d-md-inline-block">
      <img src="https://img.icons8.com/cotton/64/000000/star.png" alt="">
      <span>Certified</span>
    </p>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsable-nav"
      aria-controls="nav1" aria-expanded="false" aria-label="Open and close menu">
      <span class="sr-only">Toggle menu</span>
      <span class="navbar-toggler-icon"></span>
    </button>
    <div id="collapsable-nav" class="collapse navbar-collapse">
      <ul class="navbar-nav mx-auto">
        <li>Item</li>
      </ul>
    </div>
  </div>
</nav>
</header>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popperjs/dist/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" crossorigin="anonymous"></script>
</body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Best practices for starting and stopping trace spans in express / nodejs applications

Currently, I am conducting an experiment with utilizing the Opentelemetry.js nodejs/express library and attempting to refactor the reviews application from the bookinfo Example found in Istio. I followed the tracer configurations laid out in the sample: ...

Show a pop-up notification for a compact disc

Received a CD containing various tutorials created in HTML. I am looking to have a browser window open with specific parameters, such as no toolbars and fixed width/height, to properly display the content. Using window.open with multiple parameters trigge ...

What's the deal with this error message saying val.slice isn't a function?

In the process of developing a web application using express with a three-tier architecture, I have chosen to use a mysql database to store blogposts as a resource. Here is an illustration of how the table is structured: CREATE TABLE IF NOT EXISTS blogpos ...

React.js Material UI Dropdown Component

Is it possible to modify the behavior of the dropdown in Material UI Select? I would like to customize the appearance of <ul> so that it does not resemble a pop-up. My goal is for the selected item to be contained within the <li> element, simi ...

Adjust the initial position of the slider handle on the WooCommerce widget price filter

Is there a way to enhance the visibility of the woocommerce widget price filter by adjusting the starting position of the slider handle? For example, shifting it 10% towards the right from the beginning of the range bar. Check out the comparison of positi ...

Styling with CSS or using tables: What should you choose?

Is there a way to replicate the frame=void functionality in CSS, or will I need to manually add frame=void to each table I create in the future? <table border=1 rules=all frame=void> I attempted to search for a solution online, but unfortunately, m ...

Steps for transforming an Array of hierarchical data into the correct JSON format for D3 Tree Region visualization

I am struggling with converting an array of hierarchy data into the correct Object format. Here is what I am trying to convert: [ {"PARENT_ID": 0,"CHILD_ID": 1,"NAME": "Quality","LEVEL_A": 0}, {&qu ...

Instead of returning a single array of data from a form as expected, Jquery is returning two arrays

Having a bit of trouble with my code involving radio buttons and arrays using Jquery. I'm trying to record the selected values into one array, but it's creating separate arrays for each fieldset. Here's what I have: <script> $(doc ...

Satellizer failed to send the Authentication header to my API

Currently, I am working on a project locally with an API built in Laravel. Everything is functioning correctly - I can log in using Facebook, receive a JWT token from the API, and store it in local storage. However, even after logging in, my API calls do n ...

Error message from Google Adsense: The registration landing URL modifier is null

For the past few days, I've been encountering a persistent error message on all web pages where I have Adsense banners: "Uncaught TypeError: Cannot call method 'registerLandingUrlModifier' of null" I have been using the asynchronous script ...

Modify a particular box-shadow within a list of box-shadows using CSS

Is there a way to override one specific value in the box-shadow list while preserving all other values? For example: div{ box-shadow: 0 0 0 5px #00ff00 , 0 0 0 10px #ff0000 , 0 0 0 15px #0000ff ; } If we only want to change the second value without ...

How to include an image in a CSS file for a React project

I'm attempting to use an image from public/assets/subtract.png, but I am encountering a resolution issue. Here is the code snippet in question: body { background-image: url("./assets/subtract.png"); } The specific problem I am facing is ...

Guide to adding custom breakpoints in bootstrap 4 with CDN

I incorporate BootstrapCDN in my project. The rest of the styles are written in sass and compiled by gulp. I am looking to customize my own breakpoints. Is it feasible to do so while using CDN? I am struggling to find a way to implement this. Here are the ...

I am struggling to make mod_proxy_html function properly - no signs of debug output or errors

I have Apache version 2.0.52 running and I've successfully compiled the mod_proxy_html module (version 3.1). Apache starts without any errors, however, the issue I'm facing is that the module doesn't seem to be doing anything - there's ...

Discover the ultimate guide to harmonize IE 9 with the ingenious Bootstrap Multiselect plugin developed by davidstutz

I've come across an amazing plug-in developed by David Stutz that allows for a Bootstrap and jQuery multi-select options list. Here are some resources: Check out the source code on Github Find documentation and examples here This plug-in works fla ...

What is the equivalent of window.onload in emscripten?

In my HTML file, I have been copying and pasting the Emscripten generated code into the <script></script> region. However, the browsers tend to execute the Emscripten code before the entire HTML file has been processed. This causes issues if ...

What could be causing the error in sending JSON data from JavaScript to Flask?

Check out this cool javascript code snippet I wrote: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type=text/javascript> $(function() { $.ajax({ type: 'PO ...

Using a form tag within a table in HTML5

Can someone help me figure out how to integrate a form with the "Get" method into a table? The table includes a text field, and upon submitting the form, it should initiate validation. The validation process currently works correctly, however, when submi ...

How do I use React and Material-UI to efficiently display multiple tables from a complex JSON object containing multiple arrays of data?

Trying to come up with an innovative approach to generate a unique dynamic table component that can create individual tables based on the number of arrays in a dictionary object (essentially iterating through each array and generating a table). For my sce ...

javascript: create an image below the surface and store it

Working on a project with Censiumjs, a JavaScript map library, I am looking to create a heatmap from JSON data and display it on the map. My current approach involves utilizing a heatmap JavaScript plugin to draw the heatmap on a hidden canvas, saving it ...