What is causing the issue with my navbar 'bars' not showing up properly on mobile devices?

My navbar is not displaying the ul bars when I click on the button to open them in mobile view. Here's what currently happens:

https://i.sstatic.net/fFIzM.png

What I actually want it to look like is this:

https://i.sstatic.net/a8fSK.jpg

However, with the bars positioned below the navbar instead of above it.

Below is the code snippet for the HTML:

<nav id="nav">
    <span class="brand">Brand Name</span>
    <ul>
        <li><a href="about.html">About <i class="fa fa-angle-down"></i></a></li>
        <li><a href="portfolio.html">Portfolio</a></li>
        <li><a href="contact.html">Contact Us</a></li>
    </ul>
    <a class="nav-bars"><i class="fa fa-bars"></i></a>
</nav>

Here is the SCSS code for the navbar styling:

/*----------------
    Navbar Styles
  ----------------*/
.nav_fixed {
    position: fixed;
    top: -($info_bar_height / 4);
    z-index: 100;
}
nav {
    height: $navbar_height;
    width: 100%;
    margin: 0;

    color: $navbar_color;
    background: $navbar_background_color;
    font-weight: bold;
    letter-spacing: 0.025em;
    line-height: $navbar_height;
    text-transform: uppercase;
    
    /* Rest of the SCSS styles... */
}

/* Responsive Styles */

/* JS Code */

Lastly, here is the JS code snippet provided:

$(function() {
    // JavaScript code...
});

Answer №1

The styling of the li elements in your mobile media query is making them stack on top of each other.

To rectify this, you can change their display property to inline so that they appear next to each other from left to right.

In response to a comment:

It seems that setting the height of .ul to auto in the media query is being overridden by the fixed height of .nav. If .nav's height is defined by $navbar_height, consider setting it to auto instead -- especially within the media query if not globally.

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

The Ajax Auto Complete function encounters an issue when attempting to assign a value to the TextBox

I have a Textbox that utilizes an Ajax Autocomplete function. The function is functioning correctly and retrieves values from the database, populating them in the TextBox as well. However, there is a button on the page that triggers a query, fetching som ...

Creating two div elements next to each other in an HTML file using Django

I'm having trouble arranging multiple divs in a single line on my website. Utilizing float isn't an option for me due to the dynamic number of divs generated by Django posts. Here is the code I am currently using: Index.html <!DOCTYPE html&g ...

How can I use jQuery to set the color of every other row in a

I'm facing an issue where I want to use jQuery to set the color of alternate rows in an HTML table. However, every time I add a new row, the color of the entire table switches. Below is the JavaScript code snippet that I am utilizing: var alternate = ...

Can a Javascript file be concealed from view?

Imagine a scenario where the localhost root file is served an HTML file using the following code: app.get('/', (req, res) => res.sendfile('index.html')) Is it possible to include JavaScript files in the HTML document that are not a ...

Issues with jQuery Sliders

Hello there! I am currently in the process of creating a basic jQuery slideshow. The specific requirement for this slideshow is quite simple - I want the images to continuously slide to the left. I have come across numerous tutorials online, but most of th ...

Error: The selector "button" cannot be used in its current form as it is not pure. Pure selectors must include at least one local class or ID

<button onClick={() => resetBoard()}> Reset Board </button> While trying to import an external CSS file as a module, I encountered a problem. The CSS file looks like this... button { background-color: ...

Alpha 4.0.3 Bootstrap Carousel with Shadow

Hello there, I've been tinkering with the bootstrap website and I'm looking to add an inset shadow effect to the carousel. Here's a snippet of the HTML: <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"& ...

JavaScript 12-hour Clock Displaying 24-hour Format with AM/PM Error

I am using JavaScript to display a 12-hour digital clock that updates continuously. However, the code I found online resulted in a 24-hour clock and incorrect am/pm output. Currently, it displays 13:33 am. I have experimented with various code snippets, in ...

Issues with jquery gui elements in Chrome extension being unresponsive

Using chrome extensions and jquery to create a customized GUI, but running into issues with displaying the jquery elements on the HTML page. Can anyone spot what might be the problem? manifest.json: { "name": "my extension", "description": "my first ...

What is the recommended image size for Next.js websites?

According to documentation: The width of the image, in pixels. Must be an integer without a unit. The height of the image, in pixels. Must be an integer without a unit. https://nextjs.org/docs/api-reference/next/image Different devices come in various ...

A guide to setting up a Python CGI web server on a Windows operating system

I am looking to set up a basic Python server on a Windows system to test CGI scripts that will ultimately run on a Unix environment. However, when I access the site, it displays a blank page with no source code visible. I am struggling to identify the issu ...

Setting the minimum width for Cards in Bootstrap: A How-To Guide

I'm facing an issue with Bootstrap cards. When I set a minimum width for the cards, they end up overlapping as I reduce the window width. How can I ensure that the third card moves to the next row to prevent this overlapping? https://i.sstatic.net/XA ...

Background image for numerical input field

I am currently working on customizing a form that includes a Number field, image button, and an image. My goal is to change the background of the number field to be a similar image. Below is the HTML code I have been using: <form name="form1" id="form1 ...

Chosen Buttons for Emailing

I have recently created a multistep form and have implemented functionality to receive the form contents via PHP email. However, I am facing a challenge where, when I navigate through the form and encounter multiple buttons to choose from, the email I rece ...

Obtain database information to use as the default selection in a dropdown menu on a website using HTML, CSS, MySQL,

Hey everyone, I'm trying to retrieve data from the database to set as the default or selected option in my dropdown menu. I'm working on a page called Update Project where I have a dropdown component populated with records from my database. Howe ...

The Jquery AJAX request does not seem to be functioning properly as it consistently triggers the error function

Currently, I am in the process of developing a reset password page. However, I am encountering an issue when attempting to submit the data to the backend via an AJAX call, as it consistently redirects to the error function. Despite my attempts to troublesh ...

Issue with displaying custom error message on Mysqli connection

Currently following a tutorial from an individual who has provided the below code snippet: <?php require_once "connect.php"; $connection = @new mysqli($host, $db_user, $db_password, $db_name); if ($connection->connect_errno != 0) { e ...

Upgrading Bootstrap from version 3.4 to 5.3 in a .NET project

I have a website project created using .Net Framework 4.7.2. Currently, I am utilizing Bootstrap version 3.4.1 from here. Since Bootstrap 3.4 is now in an end-of-life phase, I need to upgrade to the latest version, 5.3. Upon replacing the old version fil ...

Is the ajax select menu in Rails only working the first time it's fired?

This question has been raised numerous times, but I have yet to find a solution that works. The issue is that my select menu functions perfectly the first time, but fails to execute again until the page is reloaded. <div class="dynamic"> <%= rend ...

Passing PHP data from one div to another using JQuery: A step-by-step guide

My HTML code looks like this: <div class="right"> <h2>Product Detail</h2> <div id="righttop"></div> <button id="Add">Add</button> </div> <div class="rightbot"> <h2>Shopp ...