The drop-down menu vanishes mysteriously before it can be selected

I'm having trouble making my pop-up menu touchable. It keeps disappearing. I've tried a few things but nothing seems to work: - Placing the display:none above the hover didn't make a difference. - Changing the position: absolute in #navbar ul ul to position: relative did change something but messed up my nav-bar. There must be a simpler solution. Hopefully.

HTML:

<!doctaype>
<html>
<head>
    <link type="text/css" rel="stylesheet" href="omer1.css">
    <link type="text/css" rel="stylesheet" href="omer1media.css">
</head>
<body>
    <div id="header">
        <h3>my_ducati.com</h3>
    </div>
    <div id="navbar">
        <ul >
            <li ><a href="#">home</a></li>
            <li ><a  href="#">menu</a></li>
            <li ><a  href="#">about</a></li>
            <li ><a  href="#">social</a>
                <ul >
                    <li><a href="https://www.facebook.com/">facebook</a></li>
                    <li><a href="https://www.facebook.com/">youtube</a></li>
                    <li><a href="https://thepiratebay.se/">thepiratebay</a></li>
                </ul>
            </li>
        </ul/>
    </div>
    <div class="sideright price1">
            <h2>prices $$$ 1</h2>
            <p>allot of money</p>
            <p>some more of that sweet sweet money</p>
            <p>just a little bit of that</p>
            <p>money money money </p>
        </div>

        <div class="sideleft price3">
            <h2>prices $$$ 3</h2>
            <p>allot of money</p>
            <p>some more of that sweet sweet money</p>
            <p>just a little bit of that</p>
            <p>money money money </p>
        </div>
        
        /* Remaining HTML code omitted for brevity */

#footer{
    background-color:blue;
    margin: 10px;
    height:20px;
    border-radius:5px;
    clear:both;
    color:lightgray;
    text-align:center;
    padding:15px;
    font-size:90%;
}

Here's a link to the fiddle : http://jsfiddle.net/KsAZ8/2339/

Answer №1

One potential solution is to adjust the margin-top property of your dropdown menu to eliminate the small space between it and the top-level navigation item. This can help fix the issue without requiring you to move your mouse quickly. For example, setting the margin-top to 0 could be a simple fix.

Check out the demo

Answer №2

This is where the issue lies

#navbar ul {
  list-style-type: none;
  position: relative;
  text-align: center;
  color: purple;
  border-radius: 5px;
  padding: 5px;
}

Additionally, include padding-top here

#navbar ul ul {
  position: absolute;
  display: none;
  text-align: left;
  background-color: #333;
  border: 5px solid #222;
  border-top: 0;
  margin-left: -5px;
  min-width: 200px;
}

Keep in mind: you might have to adjust other CSS properties for consistency with the current design

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

Having trouble with the full-screen feature not functioning properly?

I am currently in the process of creating a custom video player and I need to include a full-screen button. However, when I click on it, the video does not expand to fill up the entire screen. I am using javascript, css3, and html5 for this project. Any as ...

Easy Registration Page using HTML, CSS, and JavaScript

In the process of creating a basic login form using HTML and CSS, I'm incorporating Javascript to handle empty field validations. To view my current progress, you can find my code on jsfiddle My goal is to implement validation for empty text fields ...

Is it possible to customize the appearance of individual sections in an HTML5 range slider by changing their

I'm looking to customize a stepped HTML5 range slider by changing the background color for each step, similar to the image provided. Is this customization achievable? ...

The standard jQuery Mobile CSS styling does not seem to be working across various browsers, extensive testing has been conducted

I'm currently experimenting with jQuery Mobile to enhance my skills, but I'm facing issues with applying the basic CSS styling. I have included the css link from the jQuery Mobile website and ensured that I am connected to the internet. However, ...

Organize items within a compartment using Bootstrap3

I have decided to update my website to Bootstrap3 and encountered a common issue that many others seem to be facing as well. I am trying to evenly distribute 4 elements, each approximately 220px wide, inside a 990px container. In the old version of Bootstr ...

Minimizing the frequency of getElementById calls for the same HTML element

When dealing with repetitive function calls using the same element as a parameter, is it more effective to store the element as a global variable? For instance, imagine a function that is triggered on every key press and takes an element as an argument. ...

Some font-awesome icons are not appearing on the screen

As a beginner in web design, I am experimenting with using font awesome icons in Angular 9 projects within list items. While some of the icons are displaying properly, others are not. You can see the issue in the attached image. To access the icons, I have ...

CSS for when the mouse hovers over an element

Two php files and a js file are involved in this scenario. The issue at hand is that when the div is clicked, it navigates to a new page with an appended # to the URL, causing it to scroll to the specified comment ID. However, instead of scrolling to the c ...

Which takes longer to render: individually drawn images placed via absolute positioning, or one complete image?

I currently have a collection of "cards" on my website that are jpg images, but I am considering switching to an HTML/CSS solution. This change would involve placing numerous small icons on a background and adding stylish text on top. My concern is determ ...

Creating diagonal background cutouts using CSS

Can you create a diagonal cut in a background color using CSS? Check out this example https://i.sstatic.net/vtpYf.jpg .item { color: #fff; font-size: 30px; background-color: #565453; padding: 10px 10px 10px 10px; width: 52%; text-align: ce ...

Is it advisable to blend Angular Material with Bootstrap?

I'm brand new to Angular Material and it seems to have its own intricate API. Coming from using Bootstrap, I'm accustomed to utilizing its grid system with classes like row, containers, cols, etc. I'm curious if it's considered a good o ...

Tips for spinning HTML5 Canvas's background image and adjusting the zoom with a slider

As someone who is new to the world of coding, I have a few goals in mind: First and foremost, I want to create a canvas. I also aim to add a background image to the canvas. Importantly, this background image should be separate from any foreground images ...

Vertical Positioning of Tabs in Materialize CSS

My current challenge involves creating vertical tabs using materialize CSS, specifically in regards to positioning. The desired outcome is for the content to align at the same level when clicking on TAB 3. An example of the expected result can be seen in t ...

Fill a dropdown menu with options from a JSON object, arranging them in ascending order

I have a JSON hash that I am using to populate a combo box with the following code: $.each(json_hash, function(key, value) { $("#select").append("<option value='" + key + "'>" + value + "</option>"); }); The functionality w ...

Having difficulty in setting a Cookie with php

Working on integrating social login, I attempted logging in with Facebook. Upon successful authentication of the user, I aim to retrieve their value and store their ID in a cookie to establish a session throughout the site. Below is the code snippet, < ...

Leveraging Angular and HTML to efficiently transfer the selected dropdown value to a TypeScript method upon the user's button click

I am experiencing difficulty accessing the .value and .id properties in {{selectItem}} in order to send them back to the typescript for an HTTP post at a later time. Although there are no specific errors, I have encountered exceptions and have tried search ...

What is the best way to eliminate spaces, commas, and periods from a variable in javascript?

After attempting var res = str.replace(/ |,|.|/g, ""); and var res = str.replace(/ |,|.|/gi, "");, I'm still puzzled as to what I might be missing. var str = "Text with comma, space, and period."; var res = str.replace(/ |,|.|/g, ""); document.writ ...

Enhance Your Navbar in Bootstrap 3 by Creating Vertically Expanding Links Relative to Brand Image Dimensions

To best illustrate my issue, I will begin with a screenshot of the problem and then explain what I aim to achieve. Here is the current state of my navbar: Currently, the text of the links on the right side is positioned at the top. Additionally, this is h ...

Gather information using HTMLParser

<tr> <td style="color: #0000FF;text-align: center"><p>Sam<br/>John<br/></p></td> </tr> Utilizing the python's HTMLParser module, I am attempting to retrieve the entries Sam and John from the provided ...

How can I prevent the jQuery animation from moving elements by adjusting the border?

I've been working on a small jQuery script that animates the border of images when hovered over. However, I've run into an issue with unwanted repositioning of adjacent images due to the border width increase. $(document).ready(function(e) { ...