The menu causes page distortion on mobile devices, resulting in excess white space to the right

Although I am not a web designer by profession, I currently study copywriting and animation in college. I have teamed up with a close friend who specializes in graphic design and website development. Our current dilemma revolves around the excessive length of our website menu, which distorts the layout on mobile devices as shown in the image below.

The menu is situated near the top of the website and utilizes Javascript to fix itself at the top of the page when users scroll down. While this feature ensures a normal viewing experience while scrolling, it also creates an unwanted white space on the original position of the menu. This issue might be due to its extended length, but we are seeking assistance to rectify this anomaly. Your expertise would be greatly appreciated.

You can access the problematic page HERE, although the live link will be removed after resolving the issue for future reference.

This section outlines the CSS code governing the behavior of the menu in both its default and fixed positions upon user scrolling:

#menu, #menu ul {
margin: 0 auto;
padding: 0;
background-color: #FFFFFF;
}
#menu {
display: table;
width: 100%;
list-style: none;
position: relative;
top: -30px;
text-align: center;
-webkit-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
font-size: 18px;
height: 20px;
z-index: -101;
}
#menu.fixed {
position: fixed;
top: 0;
width: 100%;
}
#menu li {
display: table-cell;
list-style: none;
padding-right: 50px;
left: 50px;
vertical-align:middle;
}
#menu > li:hover > ul {
background:#FFF;
display: block;
left: 0;
width: 100%;
-webkit-box-shadow: 0px 3px 2px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow:    0px 3px 2px 0px rgba(50, 50, 50, 0.75);
box-shadow:         0px 3px 2px 0px rgba(50, 50, 50, 0.75);
border-top:thin dotted #999;
top: 32px;
}
#menu > li > ul {
display: none;
position: absolute;
 text-align: center;

}
#menu li a {
display: block;
padding: 2px 10px;
text-decoration: none;
font-weight: lighter;
white-space: nowrap;
color: #333;

}
#menu li a:hover {
color: #CCC;
font-size: 18px;
vertical-align: middle;
}
#menu li ul li {display: inline-block;
float:none; }

Answer №1

The issue lies not with the menu itself, but with its lack of responsiveness (in fact, the entire site lacks responsiveness). Content below appears squished on mobile devices.

I strongly recommend rebuilding the site using a responsive framework such as Bootstrap or Zurb Foundation. Utilize their grid system for organizing content blocks and carousels, and implement a mobile-friendly menu for better user experience.

One pitfall to address is the embedded CSS on each page instead of calling a unified CSS file. Consolidating your CSS can simplify maintenance tasks and updates across all pages.

Consider converting shared assets into includes by transitioning HTML to PHP. This approach, especially PHP includes, can be beneficial for elements like menus and footers.

Focusing solely on fixing the menu will not solve the underlying issue at hand.

To enhance site responsiveness, ensure that the following meta tag is included in the header:

<meta name="viewport" content="width=device-width, initial-scale=1">
.

Implement media queries to adjust the display of the menu for various screen sizes and create mobile-friendly alternatives when necessary.

For improved mobile viewing, consider setting #cell1, #cell2, and #cell3 to 100% width in mobile breakpoints for better visibility within grids.

Refer to an accessible tutorial here for helpful guidance on creating a dropdown menu suitable for mobile users.

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

Expand the background of the <li> element to cover the entire width of the <ul> element

Hey everyone, I'm struggling to make the aqua rectangles in my messages fill out the width of their parent ul. This is resulting in them not covering the entire area like the light blue rectangles do. Can someone help me figure this out? Here's ...

Combine the text of the button onto a single line

It seems like my button text appears fine on Safari, but in Google Chrome the issue arises. When you first arrive at the button, everything looks okay. However, after navigating through more posts and encountering the load more button again, the text gets ...

Two nested divs positioned below text within a parent div

I am styling a content div with text and two child divs positioned next to each other within the content div. My goal is to have the child divs display below the text, rather than beside it. body { text-align: center; } #first, #second { border: so ...

clicking on a DIV element

I am trying to trigger a JavaScript function by clicking on a DIV element, but for some reason it is not working as expected. I have gone through various examples provided by the helpful people here, but still can't figure out what I'm doing wron ...

Is there a way to create line breaks in HTML without using any tags?

I need to display some results in my React code using AJAX. However, I am facing a challenge with line breaks on the second page. The issue is that I cannot use <br/> because the result contains tags like this: hi br/ hi. Is there a way to insert a l ...

Instructions for developing an offset plugin for an HTML5 video player

I'm currently working on developing an offset plugin that allows playing a specific portion of a video in an HTML5 video player. While there is an existing plugin for video.js available at videojs-offset plugin, I am now experimenting to adapt this p ...

Steps for aligning an image to the right using Bootstrap Vue

I'm currently learning Bootstrap Vue and I'm trying to align an image on the right using a b-card header. The challenge I'm facing is that when I add the image, it disrupts the perfect size of the template header, causing the image to show a ...

Is there a way to automatically divide CSS-emulated table cells into multiple rows?

Utilizing the properties display: table and display: table-cell, I am attempting to evenly distribute some divs within a parent container. However, they all end up on the same row, causing overcrowding when there are too many divs like this: Even though I ...

Utilizing ajax for fetching a data table

I am new to using ajax and have successfully retrieved data from a table. However, I am now trying to pull in an entire data grid but not sure how to achieve this. In my index.php file, I have the following code: <html> <head><title>Aj ...

Ways to align images of the same size in a gallery using the margin: auto property

I have an image gallery within a div element named "container" with a specified width:70%. I need the images to be justified with auto margins. This is the HTML code I am using: (There are 4 images in total) <div class="container"> < ...

Checking if a specific element's scrollbar has been scrolled to the bottom using Selenium, Webdriver, and Java

Is there a way to verify if the scroll bar of specific elements has been scrolled to the bottom? I am using Selenium and Webdriver with Java for running JUnit scripts. I am unable to figure out how to achieve this. Any advice would be greatly appreciated. ...

Implementing dynamic display of div based on dropdown selection in typescript

A solution is needed to display or hide specific div elements based on a dropdown selection using Typescript. Sample HTML file: <select class="browser-default custom-select"> <option selected>single</option> <option value="1"> ...

What is the best way to stop HTML from treating user input text as an entity?

My website allows users to input text. One user entered the text "I worked on the #3&#4 valves" into an <input>. This text is stored in a database and displayed elsewhere on the screen. The issue I'm facing is that the "&#4" is being int ...

When the font size is set below 16px on an iPhone, iOS will automatically zoom in to compensate

Currently, I am running tests on my app using an iPhone. Everything seems to be working correctly on the iPad, but when I try clicking on a text field on the iPhone, the view automatically zooms in. It appears that setting the font size to 16px or larger r ...

Converting HTML to plain text on an Android device

I need help converting HTML text to plain text and displaying it in a TextView. However, I am encountering an issue where additional paragraphs are being added after the conversion. Please refer to the image https://i.sstatic.net/SxSf0.jpg Can someone exp ...

What is the best way to layer four images in a 2x2 grid over another image using CSS as the background

I am attempting to place 4 images of the same size on a 5th image defined as the background. Currently, it looks like this: It works perfectly when the height is fixed, but in my case, the height may vary causing this issue: This problem isn't surp ...

Tips for utilizing Jinja2 to produce a custom HTML email design?

I am trying to dynamically display data in an HTML email template using Jinja2 and Python. I am fairly new to both languages, but here is what I have accomplished so far: Started with my boilerplate code dynamic /dynamic.html /script.py I have cr ...

Trouble persists with Semantic-ui themes remaining unchanged even after running gulp build

I've been attempting to modify the semantic-ui theme in the theme.config file, but I'm not seeing any changes take effect. There are no errors showing up in gulp or anything. Even after deleting the semantic.min.css file and rebuilding it, chang ...

I lingered a moment too long on the left and right buttons of my Carousel

Currently facing an issue with a slideshow feature where the images are not smoothly transitioning when using the left/right buttons. The transition is either delayed, slow, or causes the page to hang. Additionally, after some time, the images automaticall ...

Trouble arises when trying to create a two-column div table with images to prevent overflow

Attempting to make a list with two items in each row and multiple rows. Encountering an issue where the image within the div is overflowing despite setting constraints. View an example here. Seeking assistance in formatting this according to my preference ...