"My drop down button menus and background image seem to be experiencing some technical difficulties. Can someone help

I'm having trouble getting a drop-down menu to work with a reptile image as the background. When I remove the image, the drop-down works fine. I've checked for errors but can't seem to find any. Is it an issue with the code or maybe a typing mistake?

Also, my background color gradient is only showing half the page and looks odd when the window is resized. I've tried various methods like setting width/height to 100%, using cover, and adjusting image height, but nothing seems to work. I want the image to stretch to fill the entire page both in height and width. It could be related to the body height, but I'm not sure how to fix it.

Here's the code:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Reptile Website</title>
    <link rel="stylesheet" href="home.css">
        <meta charset="utf-8">
            </head>
<body>
    <div id="wrapper">
        <header><nav><ul>
            <!-- Dropdown menu HTML goes here -->
        </ul></nav></header>
        
        <div class="container">
            <img src="reptile.png" alt="Reptile Background">
                <div class="herp">Explore Herping<br>
                    <h3>Your home for Herpetology Information</h3> . 
  </div>
                 </div>
         <footer>
             <p>Sasha Batz | <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4c78580828386858cf4c7c0c1d0d1dac09ad9d7d7dfd79ad1d0c1">[email protected]</a></p>
         </footer>
     </div>
  </body>
 </html>

 

Answer №1

First Inquiry:

The image causes its parent element .container to overlay the dropdown menu, preventing you from hovering over it.

You can resolve this by using z-index to ensure the proper layering:

.container {
    z-index: 10;
}
.container img {
    z-index: 11;
}
nav {
    z-index: 1001;
}

Also, avoid including the text

Your home for Herpetology Information
at the top of the menu.

Second Question:

In general, all percentage-based sizes need to inherit from their parent block elements. If any of those ancestors fail to specify a size, they are assumed to be sized at 0 x 0 pixels.

To address this issue in your CSS code, add the following:

html {
    height: 100%;
    width: 100%;
}
body {
    width: 100%;
    height: 100%;
}

Make sure that your HTML and CSS files follow the provided structure for optimal display and functionality.

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

There is a vast expanse separating the header of the page and the navigation bar

Hello! I'm trying to figure out why there is a huge space between the top of the page and the navbar on this site: . I've included the CSS and HTML below. Any help would be greatly appreciated, thank you! HTML: <!DOCTYPE html> <html> ...

Use an if statement in Angular to conditionally add a title attribute with an empty value to HTML

How can I conditionally add the title attribute to a div without creating another div and using ngIf? If the permission is true, I want to include a title in my div. Here's what my current div looks like: <div (click)="goToChangelog()&quo ...

What is the method for selecting the element currently under the mouse cursor?

Is it possible to change the color of all elements you hover over using plain Javascript without jQuery? HTML <ul> <li></li> <li></li> <li></li> </ul> JavaScript (function() { var item = ...

I could use some help navigating payment gateways

I'm new to payment gateways and would appreciate any recommendations or advice. ...

Persistent vertical menu dropdown that remains expanded on sub menu pages

I am struggling to understand how to keep my menu sub items open when on the active page. Although I have tried similar solutions, I have not been successful in implementing them. I apologize if this question has been asked before. My approach involves usi ...

Creating a custom fav icon within a button with CSS styling

https://example.com/code-example Hey there, I'm attempting to replicate the button showcased in the code example above. However, I'm facing a challenge when trying to incorporate the stars without altering the existing script. Another issue is w ...

The usage of the bootstrapTable() function creates a gap below the displayed table information

Currently, I am working on incorporating a table into my webpage that will load data from an API. After some research, I found a Bootstrap table library to assist with this task. However, I have encountered an issue with setting the table height dynamicall ...

When utilizing the Express framework, the object req.body is initially empty when collecting data from a basic

I'm encountering an issue where I receive an empty object in req.body when submitting my HTML form. This problem persists whether testing in Postman or directly submitting the form from localhost in the browser. Upon logging it in the node console, t ...

What is the best way to incorporate a variety of colors into a single element?

Using a combination of colors in one element I'm looking for ways to incorporate multiple colors into a single element effectively. My initial attempt with the color mix function didn't work as expected, so I need new ideas and techniques on how ...

The jQuery functions properly offline, but fails to load when connected to the

I am encountering an issue with the following script: <script type="text/javascript"> $.getJSON("http://api.twitter.com/1/statuses/user_timeline/koawatea.json?count=1&include_rts=1&callback=?", function(data) { $("#headertweet") ...

Building a Responsive Page with Bootstrap 4

I'm currently working on a design page with 2 boxes on the left side and 3 boxes on the right. It looks great on desktop, but I want the boxes to display individually on mobile devices and I'm having trouble figuring it out. Here is my code: < ...

What is the most effective method for incorporating keyframes using JavaScript in a dynamic way?

Is there a way to animate an HTML element by using a variable with keyframes, but without directly manipulating the DOM? Below is the HTML code: <div class="pawn" id="pawn1"></div> Here is the CSS keyframes code: @keyframe ...

Dynamic height of a fixed-positioned Div

I encountered an issue with a Fixed positioned DIV that has dynamically appended content using jQuery. Once the height of the DIV exceeds the screen size, I am unable to view the contents at the bottom of the DIV without zooming in using the browser' ...

Showing the Length of Several Videos Simultaneously on a Webpage

I am attempting to showcase the "duration" for each video on the page using JavaScript. This is my current code: var vid = document.querySelector(".mhdividdur"); vid.onloadedmetadata = function() { var x = document.querySelector(".mhdividdur").duratio ...

Can you tell me the Bootstrap 4 equivalent class for '.well'?

While using bootstrap-3, the .well class can be utilized to create a rounded border around an element with a gray background color and padding. <div class="well">Basic Well</div> However, it seems that there is no .well class available in boo ...

Hovering Div Troubles

I've been working on creating a hover effect for the blocks on my website. Everything was going smoothly until I reached the last block. The hover effect appears to be displaced, as shown in this sample link. Although the CSS code I'm using seem ...

What is the best way to determine which button was clicked in Django?

My HTML has two buttons - one for accepting and the other for rejecting requests. I am trying to figure out how to determine which button was pressed along with the email of the applicant (tutor_application.tutor.chalkslateuser.email). Despite multiple a ...

Retrieve information using Angular's EventEmitter

Recently I started learning Angular and encountered a challenging issue that has kept me occupied for the past few hours. I have implemented a parent-child relationship between two components, with a need to share a boolean variable from the parent to the ...

image appears hidden by object displaying a YouTube video due to z-index property

I am attempting to overlay a png image on top of an object element that contains a YouTube video. See the code snippet below: <object> scripts... </object> <img src='src' style='position:absolute;top:-10px;z-index:99;' ...

Struggling with dynamically updating fields based on user input in real time

I have a goal to update a field based on the inputs of two other fields. Currently, all the fields are manual input. Below is the code I'm using to try and make the "passThru" field update in real-time as data is entered into the other fields. The ma ...