Issue with drop-down menu functionality on mobile-friendly website

After deciding to revamp my website for responsiveness, I encountered an issue with the menu not displaying on smaller screens. Everything else is functioning correctly except for the drop-down menu!

Here is the HTML code:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8>
    <title>Alffi's "Blog"</title>
    <link rel="stylesheet" type="text/css" href="CSS/style.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
    <header>
        <h1>Welcome to Alffi's "Blog"!</h1>
    </header>
    <nav>
        <ul>
            <a href="#"><li>Home</li></a>
            <a href="#"><li>About Me</li></a>
            <a href="#"><li>Current Projects</li></a>
            <a href="#"><li>Downloads</li></a>
            <a href="#"><li>Login</li></a>
        </ul>
        <div class="handle">Menu</div>
    </nav>
    <section>
        Test Text: ldsngfgnfkgkgkgkfgjnbgjfsgkjfljfngfngfdlgnfdlgnfdlkgnfdlgnflknglkfgnlfnglfgnflgnfklgnkfgnlfkgnlfkngfdlkgnfdlkgnfdklgnfdklgnfdklngfdlkgnfkgnfdlkgnfdlgnflgndflkgnfdklgnfdklfdnlgkfdnlfdnglkfdnglfdknglfdkgnlfdkgnfdklgnfdklgnfdklgnfdlgnfdlkgnfdlkgnfdlkgnfdlkgnfdklgnfdlkgnlfdknglfd
    </section>
    <script>
    $('.handle').on('click', function(){
        $('nav ul').toggleClass('showing');
    });
    </script>
</body>
</html>

Furthermore, here is the CSS code:

    body{
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}
header{
    background: #00795f;
    width: 100%;
    padding: 40px 0;
    color: white;
    text-align: center;
}
a{
    text-decoration: none;
    color: inherit;
}
nav ul{
    background-color: #43a286;
    overflow: hidden;
    color: white;
    padding: 0;
    text-align: center;
    margin: 0;
    -webkit-transition : max-height 0.4s;
    -ms-transition : max-height 0.4s;
    -moz-transition : max-height 0.4s;
    -o-transition : max-height 0.4s;
    transition : max-height 0.4s;

}
nav ul li{
    display: inline-block;
    padding: 20px;
}
nav ul li:hover{
    background-color: #399077
}
section{
    line-height: 1.5em;
    font-size: 0.9em;
    padding: 40px;
    width: 75%;
    margin: 0 auto;
}

.handle{
    width: 100%;
    background: #005c48
    text-align: left;
    box-sizing: border-box;
    padding: 15px 10px;
    cursor: pointer;
    color: white;
}

@media screen and (max-width: 580px){
    nav ul{
        max-height: 0;
    }
    .showing{
        max-height: 20em;
    }
    nav ul li{
        box-sizing: border-box;
        width: 100%;
        padding: 15px;
        text-align: left;

    }
    .handle{
        display: block;
    }
}

Your assistance in resolving this issue would be greatly appreciated!

Answer №1

Notice the menu handle is visible, located just below the header with white text.

To modify the CSS background, adjust it from nav ul to nav:


nav {  /* Update background color here */
    background-color: #43a286;
}

nav ul{
    background-color: #43a286; /* Do not make changes here */
    …
}

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

Display additional text when hovering over an object

Is there a way to make my text expand and display all of its content when hovered over, especially for those sections that are longer than the div size? I currently have some code implemented, but it seems to reveal the text horizontally. I am looking fo ...

Tips for Preventing Ant Design from Overriding Existing CSS Styles

Currently, I am working on a ReactJS project. Initially, the entire project was designed using pure CSS. However, I decided to incorporate a small Antd component into my project. Following the provided instructions, I imported the component like this in on ...

When running Javascript code locally, the function works perfectly fine. However, once published, the function encounters a

After spending hours working on cascading dropdown lists and finally getting them to function properly, I published the project only to find that it didn't work as expected. The second list failed to populate. Upon checking Firebug's console, an ...

How to align Material UI's <TextField> component in the middle of a React project

I'm struggling to align two <TextArea> components using material ui and React. Both of them are contained within the same <div> and share the same className. Despite trying to apply the !important rule in CSS, I haven't been able to ...

CSS Grid expands the item width on its own when there is still space left

Having some queries regarding the piece of code provided. Currently, I have a collection of 5 cards displayed in rows of 3 cards each using the styling grid-template-columns: repeat(3, minmax(200px, 1fr));. My concern is whether there is a way for the 4th ...

There seems to be an issue with Jquery not triggering the Webservice method in the Firefox browser, despite it working successfully in Chrome

Currently, I have an issue where a webservice method called via ajax in jQuery is functioning correctly in Chrome and IE browsers but not in Firefox. Here is the jQuery code: $("#btnUpdate").click(function () { var objEmp = { employeeID: $("#Em ...

Utilize PHP for loop to output form values into XML format

Hey there, I'm currently facing an issue with setting up a for loop in PHP to transfer the content of an HTML form into an XML file. It works perfectly fine without the for loop, but throws errors when included. Can anyone provide some insights? It&ap ...

Receive File - Error 500 from Server

Getting a 500 Internal Server Error after uploading a large zip file using jQuery and CodeIgniter is causing some confusion. The progress bar completes, but the error appears in the console log without a clear reason. The strange part is that it works fine ...

Using various alignment options for images on mobile devices

I've designed a theme with two columns, one for text and the other for images. I've structured it in HTML to display as: Text - Img Img - Text Text - Img Img - Text Text - Img Img - Text However, for mobile responsiveness, I want it to display ...

Pressing the shortcut key will activate the function specified in ng-click,

I have been searching for a solution to my problem, but I haven't found anything that really helps. What I am looking for is a shortcut within an ng-click directive where there is only an if condition without an else expression. Essentially, I just wa ...

Checkbox offering a tri-state option

Seeking help on creating a checkbox with three states. I have implemented a method to toggle between these states upon clicking. However, the issue is that this method is only triggered after the HTML changes. As a result, the checkbox's navigation be ...

Conceal content after a specific duration and display an alternative in its position, continuously repeating the loop

Imagine creating a captivating performance that unfolds right before your eyes. Picture this: as soon as the page loads, the initial text gracefully fades away after just three seconds. In its place, a mesmerizing animation reveals the second text, which ...

Create a 3D vertical flip effect for images using CSS

Learning About HTML <div class="container"> <div class="wrapper"> <div class="im-fix"><img src="foo.jpg"></div> <div class="img-closed"><img src="foo-close.jpg"></div> <div class="img- ...

The Datalist feature in HTML5 offers an auto-suggest functionality that displays a list of options beginning with the

In my project, I am utilizing HTML5 Datalist for autosuggestion. By default, HTML5 follows the keyword contains approach rather than the starts with approach. For example, if my datalist includes one, two, three and I type "o" in the search box, it displ ...

Text with background coloring only

My text background always extends beyond the screen. Can anyone help me figure out what I'm doing wrong? Here is the HTML code: <div class="textSlide"> <span id="firstTitle">We assist you in finding all the individu ...

Why isn't pagination typically positioned inside of a tbody element rather than before or after it?

I've created a user table that is based on the number parameter. I added a filter that listens to input and performs an AJAX call each time with the filter applied to the name field. However, the pagination is initially displayed ABOVE the entire ta ...

What is the best way to iterate through a JSON array using jQuery?

I am working on a PHP page that retrieves JSON responses: [{'com':'something'},{'com':'some other thing'}] My goal is to iterate through the response and append each item to a div. This is my attempted solution: va ...

Step-by-step guide on crafting a scrolling marquee with CSS or Javascript

I am in need of creating two marquees for a website project. The first marquee should showcase a repeating image while the second one should display links, both spanning the browser window at any size. It is crucial that the marquee items are displayed fro ...

Tips for sending textarea data via AJAX with TinyMCE

Recently, I encountered an issue with submitting forms using the TinyMCE Jquery plugin. While regular input fields like text fields and select boxes submit just fine, there seems to be a glitch when it comes to submitting a textarea with TinyMCE. It requir ...

The Plupload internal version seems to be incorrect. The file is labeled as 2.3.9, however, the actual version within the file is 2.3

We recently identified a security vulnerability issue with plupload 2.3.6 being deemed as vulnerable. To address this, we downloaded version 2.3.9 from the official Plupload website here: Upon inspection, we found that the zip file is labeled as 2.3.9, bu ...