What could be causing the unresponsive hamburger button on my navbar?

As a beginner in HTML and Flask, I am attempting to create a navbar. However, I am encountering an issue with the hamburger button not functioning properly. When I resize the window smaller, the hamburger button appears but does not show the items like "Login," "Home," or "Sign Up" when clicked.

 /*Any color-related styles are defined in this CSS file */

/*body, paragraphs, etc*/
* {
    margin: 0px;
    padding: 0px;
    font-family: 'Genos', sans-serif;
}
/*background color*/
body{
    background-color: #beeaa9 !important;
}
.navbar-dark .navbar-nav .nav-link {
    color:white;
}
/*Navbar color*/
.bg-custom-1{
    background-image: linear-gradient(90deg,#5ae958 35%, #58e9af 100%) !important;   
}

/*Navbar toggler color*/
/*
.navbar .fas{
    color: rgb(30, 47, 47)!important;
    font-size: 26px;
} 
*/

/*Margin-right, font size*/
.navbar-nav{
    text-align: right;
    margin-right: 20px;
    font-size: 20px;
}

.bg-custom-1 .navbar-toggler{
    padding-right: 20px;
    outline: none;
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8"/>
        <meta name= "viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.united.css') }}">     
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
        <link rel="stylesheet" href=https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css>
        <title>Bank App Web</title>
    </head>
    <body>
        <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">

        <div class="header">
            <nav class="navbar navbar-expand-lg navbar-dark bg-custom-1">
                <a class=navbar-brand href=""><img src="{{ url_for('static', filename='img/logo.png')}}"> </a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"></button>
                    <span class="navbar-toggler-icon"></span>       
                </button>

                <div class="collapse navbar-collapse" id="navbarNav">
                
                    <ul class="navbar-nav mr-auto">
                        <li class="nav-item"> 
                            <a class="nav-link" href="{{ url_for('main') }}">Home </a>
                        </li>
                        <li class="nav-item" >
                            <a class="nav-link" href="{{ url_for('first') }}">Login</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('first') }}">Sign Up</a>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    
    </body>
        
</html>

The HTML and CSS files are provided above! If anyone can help me figure out why it's not appearing as expected, I would greatly appreciate it!

Answer №1

To make Bootstrap work properly, you need to include its JavaScript plugin (documentation).

Add the following code snippet to your page:

 /*All color-related styles go in this CSS file */

 /*body, paragraphs, etc*/
 * {

    margin: 0px;
    padding: 0px;
    font-family: 'Genos', sans-serif;

}
/*background color*/
 body{
background-color:  #beeaa9 !important;
}
.navbar-dark .navbar-nav .nav-link {
    color:white;
 }
/*Navbar color*/
.bg-custom-1{

    background-image: linear-gradient(90deg,#5ae958 35%, #58e9af 100%) !important;
   
}

/*fa-bars color
.navbar .fas{

    color: rgb(30, 47, 47)!important;
    font-size: 26px;

} 
*/
/*margin-right, font-size*/
.navbar-nav{
    text-align: right;
    margin-right: 20px;
    font-size: 20px;
    /*space between buttons*/
}
.bg-custom-1 .navbar-toggler{
    padding-right: 20px;
    outline: none;
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8"/>
        <meta name= "viewport" content="width=device-width, initial-scale=1.0">

        <!-- Include these -->
        <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81ebf0f4e4f3f8c1b2afb4afb0">[email protected]</a>/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83e1ececf7f0f7f1e2f3c3b7adb5adb2">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>


        <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.united.css') }}">    
 
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
        <link rel="stylesheet" href=https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css>
        <title>Bank App Web</title>
    </head>
    <body>
        <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">

        <div class="header">
                <nav class="navbar navbar-expand-lg navbar-dark bg-custom-1">
                    <a class=navbar-brand href=""><img src="{{ url_for('static', filename='img/logo.png')}}"  > </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 mr-auto">
                            <li class="nav-item"> 
                                <a class="nav-link" href="{{ url_for('main') }}">Home </a>
                            </li>
                            <li class="nav-item" >
                                <a class="nav-link" href="{{ url_for('first') }}">Login</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="{{ url_for('first') }}">Sign Up</a>
                            </li>
                        </ul>
                    </div>
                </nav>
        </div>
        
    

    </body>

        
</html>

(Remember to remove the extra closing HTML tag for your button (</button>) before the contained <span> element.)

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

Applying CSS transition delays to multiple images

I'm having trouble implementing a transition delay in my CSS. I've tried adding it in various places but it doesn't seem to be working as expected. This is my CSS: .imageBox { position: relative; float: left; transition ...

Is there a way to display the contents of a zipped file using an HTML IFrame?

Can I display the contents of a zipped file in an HTML iframe? For example: My_File.pdf.zip contains My_File.pdf. I currently have something like this <iframe src="/path of the folder/My_File.pdf.zip" /> The src attribute points to the zipped file ...

Is there a way to manipulate CSS to update automatically when new content is loaded via ajax?

I need help with customizing the CSS for 4 image links on my website. Each link is represented by a small image in its normal state and a larger image when hovered over. The content for each link is loaded using ajax. My question is how can I modify the C ...

Utilizing the '<' or '>' operator in combination with an if statement within a Repeater component

Is it possible to use an if statement in a repeater like this? <%#Eval("FN").ToString().Count > 0 ? "SB" : "" %> When I try to implement this, I receive an error 73 indicating that the > operator cannot be used. How can I adjust it so that i ...

|Webview|Best Practices for Integrating Upload Script

I am currently developing an Android app using WebView and I need to implement a code for uploading on Android. I came across the following code snippet and I want to convert it into JavaScript instead of Java (if possible). It needs to be linked to the up ...

The .remove() method is ineffective when used within an Ajax success function

I am facing an issue with removing HTML divs generated using jinja2 as shown below: {% for student in students %} <div class="item" id="{{ student.id }}_div"> <div class="right floated content"> <div class="negative ui button compa ...

Assign a value to the active textbox using JavaScript

Hello everyone, I am working on a page with three textboxes and one listbox. I would like to have functionality where if the user clicks on the first textbox and then selects an item from the list, that selected item should be automatically set as th ...

What is the best way to reduce a varying percentage as the value continues to rise?

My memory of math may be a bit fuzzy, but I can't seem to recall how to solve this particular issue. In jQuery, I have been adding randomized clipping paths to my images using the following code: var max=100; var spread=5; jQuery.each( $("img"), func ...

Are there any alternative methods to avoid duplication of Navbar link margin classes in Tailwind CSS?

It feels really repetitive to have to add margin classes to each LI manually on a non-dynamically generated menu. It almost seems as messy as using inline style attributes... Is there a more efficient way to handle this? While it may not be a big deal fo ...

What could be causing my website to lose its responsiveness after linking a domain?

Recently, I created a basic website for an event in my town using AWS Amplify from Amazon. Initially, the website was hosted without a custom domain and had a random URL. It worked well on both web and mobile platforms. However, after connecting a custom d ...

Retrieve information from a cell containing HTML formatting

Is there a way for me to save a specific text from a cell in Google Sheets into a variable, and then use it to send an email with the text formatted within an HTML table? For example: Cell in Google Sheets: "Lorem ipsum dolor sit amet. Ut tenetur a ...

Utilize jQuery to dynamically load and assign unique ids to elements within an array

I am seeking assistance with dynamically assigning unique IDs to elements in an array using JavaScript and jQuery. I am new to these languages and need some guidance. function assignIds() { var elementIds = ['name', 'lname', ' ...

Obtain offspring from a parent element using jQuery

$(document).ready(function() { $.ajax({ type: "POST", url: 'some/url', data: { 'name':'myname' }, success: function (result) { var result = ["st ...

Is misbehavior expected at approximately 600 pixels in width?

What is happening with my website when the width is minimized, and how can I resolve it? Issue The website appears fine on mobile devices and full screens, but at reduced sizes, the background image disappears and the top bar behaves strangely (with the l ...

Ways to extend the length/size of the HTML5 range input type

Is there a way to adjust the length or size of the HTML5 range input for it to appear longer or bigger? <!DOCTYPE html> <html> <body> <form action="/" method="get"> Points: <input type="range" name="points" min="0" max="10"& ...

Deleting tasks from the to-do list using Node.js and Express with EJS

Looking to implement functionality where each list item can be removed from a Node.js array by clicking on an HTML button using EJS and Express: I am considering placing an HTML button next to each list element so that the selected element can be removed ...

Using Ajax for submitting forms with jquery and html techniques

I am having an issue with my form submission page. I need to call a function at the time of form submission using AJAX. The form submission should occur or not based on certain conditions in the AJAX response. Below is the code I have, but it seems to be n ...

getting information from a JSON array using AngularJS

Looking to extract all images from the imagePath array in the following JSON. While retrieving a single image works fine, encountering difficulties when trying to fetch the entire imagePath array. Any help with this issue would be greatly appreciated. Than ...

Exploring the optimal approach for distinguishing between numbers and strings in a JavaScript/Typescript class

I recently encountered a situation with my Typescript/React solution where I defined a property as a number and set the input type to "number", but when the state value was placed in an input field, it would change to a string unless properly handled. In ...

Guide to using two UI grids simultaneously with the directives ng-hide and ng-grid

As a newcomer to AngularJS, I am attempting to create a page with two ui-grid elements and a button labeled "other-grid". The goal is for the first grid to load initially, and when clicked again, it should be replaced by the second grid. However, I am en ...