Issue with media screen css not working on the fixed menu

My website has a fixed menu. However, I noticed that if the browser size is small, the menu shifts left by -130px instead of -20px. Can anyone help me understand why this might be happening?

#nav {
    left: -20px;
    list-style: none;
    margin: 0;
    position: fixed;
    top:0;
    margin-top:415px;
    z-index:99;
}
@media screen and (max-width: 600px){
#nav {
    left: -130px;
    list-style: none;
    margin: 0;
    position: fixed;
    top:0;
    margin-top:415px;
    z-index:99;
}
}

Answer №1

give this a shot

@media screen and (max-width: 600px){
#nav {
    display:none;
}
}

Answer №2

Have you tested this out?

@media screen and (min-width: 601px){
 #nav {
    left: -20px;
    list-style: none;
    margin: 0;
    position: fixed;
    top:0;
    margin-top:415px;
    z-index:99;
 }
}
@media screen and (max-width: 600px){
 #nav {
    left: -130px;
    list-style: none;
    margin: 0;
    position: fixed;
    top:0;
    margin-top:415px;
    z-index:99;
 }
}

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

What are the advantages of storing data in HTML tags that do not contain any content?

Is it considered poor practice to include an empty span in a template, or is there a more effective solution available? Is it acceptable to use a blank span tag like this within my code? <span class="stored-id-number" data-idnumber="1234"><!-- em ...

The width attribute for table cells does not seem to be recognized

Currently, I am in the process of creating an HTML signature. However, I seem to be facing an issue with setting the width for the td element. Here is a visual example that illustrates the structure and where I am encountering difficulties: https://i.ssta ...

Information is not transferring to Bootstrap modal

I attempted to send a value to a modal by following the instructions on the Bootstrap documentation here. However, I am facing an issue where the data is not being successfully passed. To trigger the modal, use the following button: <button type=" ...

Images, CSS files, and JavaScript files in asp.net mvc are experiencing issues with caching

To ensure better security and consistency, I made sure that my pages were not cached. Whenever I pressed the back button on my browser, it always contacted the server to retrieve the HTML content. I accomplished this by implementing a custom action filter ...

What could be causing this Jasmine test to fail, and is it necessary for all functions to be within the scope in order to be tested

My inquiry involves two separate questions: Question One When conducting Jasmine based Angular testing, is it necessary for all functions to be on the scope in order to be tested? For instance, when I attempt to call a function within the test suite like ...

Steps for determining the grade earned by an individual

Seeking assistance with my Homework assignment as I am struggling to calculate it accurately. The code provided is what I have so far, and this is the task outlined by my teacher: Develop a webpage that displays the heading "Student Grades" and allows in ...

Preserving form input after an unsuccessful submission: A simple guide

As a beginner in the coding world, I am currently working on creating a contact form using PHP. One of the features I've included is a reCaptcha that must be checked before submitting the form. However, if the user forgets to check the reCaptcha and h ...

Tips for implementing fixed width on child divs within a fixed parent div

Feel free to check out the link above. The menu is designed to have a fixed position, so when you scroll down it will stay visible, which is exactly what I intended. You'll notice there are numerous menu items within the Fixed menuWrapper which span ...

Tips for positioning elements in a way that prevents CSS fixed from overlapping upon page loading

Is there a way to adjust my navigation menu to prevent overlap upon page load, but have it overlap when scrolling down (Dynamic nav bar)? Check out my current setup: Upon initial page load, the navigation bar overlaps the text. I would like the navigatio ...

What could be the reason my JavaScript alert is not functioning properly?

Having some trouble with my form validation using Bootstrap - the alerts aren't showing up when I submit the form. Not all of the alerts have been added yet. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

Tips for refreshing only a portion of a webpage using JavaScript/jQuery

I have two distinct navigational sections on my website. The left column has its own navigation menu, while the right column (main content area) contains a separate set of links: My goal is to click on a link in the left-hand sidebar (such as "Resume", "E ...

Customizable Dropdown Button using HTML and Bootstrap

Can anyone assist me with my dropdown button code issue? It doesn't seem to be working properly. Here is the code I am using: <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" ...

Limit Content to be contained within a Bootstrap Container/Div

How can I shrink the content inside a container without distorting images? When the screen size decreases, all the images and content inside start to lose their alignment and sizes begin to change. I am aware that this may make the content harder to see. ...

Using a dynamic image source in an Ionic 3 background

I am using ngFor to display a list of posts, each of which should have a unique background image. The getBackgroundStyle function is responsible for extracting the URL of the image from the post array. <div class="singlePost" *ngFor="let post of da ...

Modify the appearance of a single component among a collection of 20 instances

I'm looking to dynamically change the background color of my components based on the colors of the images inside them. Each component should have its own unique color, but currently all 20 instances on the page are getting the same color. I've tr ...

What is the method to ensure an element is displayed in Selenium WebDriver?

Looking for assistance on how to choose options from a dropdown when the element is not visible and has a boolean attribute? Here's the HTML code snippet: <select id="visualizationId" style="width: 120px; display: none;" name="visualization"> & ...

Keeping information saved locally until an internet connection is established

I have a vision to develop a Web app focused on receiving feedback, but the challenge lies in the fact that it will be utilized on a device without an internet connection. The plan is for it to save any user input offline until connectivity is restored. Th ...

Enhancing Responsive Tables with Vertical Alignment in Bootstrap 4

When utilizing Bootstrap 4 and adding table-responsive to a table, the text may no longer be centered vertically. Is this a bug? If not, is there an easy solution available to center the text in the middle? A pure Bootstrap solution would be greatly apprec ...

What is the best way to incorporate a color-changing animation into a countdown border, resembling a spinner?

I am looking to implement a timer using jQuery that will start once this circle on the page is reached. The idea is for the border color (currently white) to progressively change to red, resembling a loading spinner effect commonly seen online. After reach ...

Submitting a form with dynamic columns and rows can be achieved by carefully designing the form to

Below is the form structure: <table id="participants" class="table table-bordered table-hover table-responsive text-center"> <form action="unique-controller.php" method="post" id="uniqueForm" enctype="multipart/form-data"> <input type="hidd ...