The drop-down menu and input fields must have an opaque background, not transparent

I'm currently working on a Google clone project, and I've run into an issue with the dropdown menu. It looks fine when the viewport width is wide enough, but it becomes transparent and hides behind the input field when the viewport is small, as shown in this image:

Screenshot Link

Does anyone have any suggestions on how to fix this issue? Please test it in a responsive viewport.

You can view the problem here: Google Clone Demo

PS: I have already attempted to adjust the z-index property, but it hasn't resolved the issue.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Google Clone Optimized (by Diefonro)</title>
    ...
    <link rel="stylesheet" href="styles.css" />
  </head>

  <body>
    <header>
      <nav>
        ...
      </nav>
    </header>

    <main>
      <section>
        ...
      </section>
    </main>

    <footer>
      <div class="footer-cont">
        ...
      </div>
    </footer>
  </body>
</html>

* {
    margin: 0;
  }
  
  html{
    min-width: 100vw;
    overflow-y: hidden;
  }
  body {
    font-family: Arial, sans-serif;
  }
  
  ...
  



Answer №1

Your webpage contains several positioned elements, but none of them are utilizing a z-index. Simply assigning a z-index value to your dropdown element will resolve this issue. Additionally, the current transparent background of the dropdown allows other elements to show through. To fix this, include a background color in your styling.

.drop-down-menu
{
  z-index: 1;
  background-color: #f5f5f5;
}

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 is the best way to retrieve text from the p tag and input it into the text field?

Looking to resolve a situation where two identical IDs exist and need to implement some JQuery. The objective is for the input value to automatically update itself based on changes in the text of the p tag. $(document).ready(function(){ ...

Achieving Text Wrapping Around Unconventional Shapes Using CSS

I'm currently facing a challenge in getting text to wrap around an irregular shape on a web page. Despite numerous attempts, I have yet to find a solution that meets my requirements. Attached is an image illustrating the layout I am aiming for. The ...

Guide to implementing Infinite AJAX Scroll in jQuery with a continuous loop

Being a beginner in javascript, I am eager to learn new techniques. I am currently working on implementing an infinite Ajax scroll into my code. Here is a snippet from my php page: <div class="row row-sm padder-lg "> <?php foreach ($top->fee ...

Issues with Media Queries on Desktop Devices

I've encountered an odd issue with my media queries. While they function properly on my mobile devices, resizing my desktop browser doesn't seem to trigger the changes. This prevents me from inspecting my mobile styles using web inspector/firebug ...

Is your Jquery validation malfunctioning?

I am currently facing a challenge with required validation on an asp.net page. In order to validate the inputs, I have implemented multiple controls which can be hidden or displayed based on certain conditions. These controls include checkboxlists, dropdow ...

What is the method for tallying CSS page breaks in printed HTML documents?

Currently, for my report generation process using HTML and CSS to manage page breaks dynamically. I've enabled the option for users to print multiple reports at once by combining them into different sections within a single HTML document. This helps p ...

What is the process for swapping out a file input tag with a specific file already chosen?

As I attempt to process a file one line at a time, I came across this helpful solution. Unfortunately, the method involves using a file input tag to choose a file for reading. I am in search of a way to bypass the file input tag and specify a file in advan ...

Hidden Document Scroll Offset

When CSS is used to hide scrollbar html, body { width: 100%; overflow-x: hidden } The above code snippet removes the scroll from the window but triggers it on the body element. To calculate the scroll values in such cases, you can use: pageOffset = ...

Generate responsive elements using Bootstrap dynamically

I'm having success dynamically generating bootstrap elements in my project, except for creating a drop-down menu. ColdFusion is the language I am using to implement these div elements: <div class="panel panel-primary"><div class="panel-head ...

What is the process for decoding HTML content that is wrapped within JSON data?

I have a web application built using asp.net that utilizes ajax calls. Below is the code snippet for my web method which successfully responds to the ajax call. ADController adc = new ADController(); DataTable dt = adc.GetGeneral(Convert.ToInt32(A ...

jQuery's ability to load pages seamlessly is unmatched

My website is filled with images, and in order to speed up the loading time, I added a loading screen. Currently, it's a white overlay with the following CSS: #loader{ width: 100%; height: 100%; position: fixed; z-index: 9999999999999 ...

Heroku encounter an H14 error - "the absence of running web processes"

An H14 error occurred during deployment on Heroku. Here is my Procfile: web: gunicorn -w 4 -b 0.0.0.0:$PORT -k gevent main:app Error log on Heroku: 2017-01-23T10:42:58.904480+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method ...

Creating a spacious text box for an enhanced Ajax search feature

I'm currently working on an AJAX application that allows users to input the name of a movie, and then loads results from the database through jquery using a PHP API. However, I'm facing a challenge in implementing a text box with the following re ...

ckeditor ruined my header section

My website has a header that stays fixed at the top, much like Facebook. https://i.sstatic.net/sQOCG.png Unfortunately, when I scroll down, the CKEditor toolbox ends up overlapping and disrupting my fixed header. https://i.sstatic.net/RxFJ9.png ...

Which target should be specified for pressing Enter in a Javascript Alert using Selenium IDE?

Seeking assistance with creating simple test cases using Selenium IDE. Encountering difficulties when recording test cases involving Javascript alerts, as Selenium does not support these pop-ups. Attempted a workaround by simulating the Enter key press wh ...

When setting the margin to auto, it perfectly centers elements on servers and IE, but on Chrome off the server, it appears to be aligned to the

There seems to be an issue with the display of my page in Chrome - it starts at the middle and ends on the right side. However, when I view it on my server or try it on Internet Explorer 11, it appears centered. Why is that? This problem only arose after ...

updating the content of a webpage using innerHTML on Squarespace platform

Could anyone help me with changing the status from "sold out" to "coming soon" on this specific page? Below is the code I have tried, but unfortunately, it is not working as expected. window.onload = function() { document.getElementsByClassName("produ ...

The dilemma of calculating the total width of jQuery's list items

I am in the process of creating a submenu that should look like this: HTML: <ul class="mainMenu clearfix"> <li><a href="#">Eurodan huset</a></li> <li><a href="#">Hustyper</a></li> <li&g ...

How come it is not possible for me to choose all elements containing an attribute value saved in a variable?

Imagine you have the following snippet of HTML code: <div data-id=5>...</div> <img data-id=5 src=...> <input data-id=5 ...> ... Your task is to select and remove all elements with the attribute data-id set to 5. Here is one attemp ...

Ways to conceal a div element when the JSON data does not contain a value

If the value in "desc" is empty, then hide <div24> and <popup-desc>. html <div class="popup"> <div class="popup-top" style="background-color: '+e.features[0].properties.fill+';"> ...