The :hover effect is not supported on iOS devices

I have a basic navigation menu that includes a hover effect:

<nav id="menu">
    <div><a href="#">Home</a></div>
    <div>
        <a href="#">1</a>
        <nav>
            <div><a href="#">1.1</a></div>
            <div><a href="#">1.2</a></div>
            <div><a href="#">1.3</a></div>
        </nav>
    </div>
</nav>

Here is the CSS used for this hover effect:

#menu > div > nav {
    display: none;
    position: absolute;
    z-index: 9999;
}
#menu > div:hover > nav {
    display: block;
}

However, the :hover state of the menu never goes away. Even after clicking elsewhere on the page, the hover effect persists. Is there a way to remove this without using JavaScript? (View the Fiddle)

It appears that the only way to eliminate the :hover state is by focusing on another element or hovering over something else.

Answer №1

Unfortunately, hover states may not work properly on certain mobile devices due to the limitations of hovering over elements. In order to achieve desired effects, consider using JavaScript instead.

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

I require assistance in clearing the text field under specific circumstances

Incorporated in my webpage are text area controls that have been coded to automatically create a bullet-list when the user clicks on the text area or presses the 'ENTER' key. However, there is an issue - if the user clicks on the text area withou ...

obtaining the values from a dynamically generated group of checkboxes

My dynamic checkboxes are categories that can be selected individually. <input type="checkbox" name="SubCats" class="subcat-checkbox" value="18001700">first</input> <input type="checkbox" name="SubCats" class="subcat-checkbox" value="180018 ...

Is there a way to reverse the hover effect on div elements?

Let's start by examining the code I've written: HTML: <div class="button_container"> <div class="inner_button"> <a href="#" class="button_text">Button</a> </div> <div class="button_side"> ...

Assign a value of 0 to the ngModel if it is empty

I am trying to ensure that when the value is null, it defaults to 0. At the moment, I am utilizing Angular PrimeNG components. <p-calendar [(ngModel)]="model.start_time" [timeOnly]="true" placeholder="00:00"></p-calen ...

javax.el.MethodNotFoundException: JSP method cannot be located

While compiling the JSP template, I encountered the following exception: The method getFriendImage() is not recognized I attempted to rebuild the class without success. The src attribute contains a valid link to an image that is functioning properly. ...

Browsing through files on IE8 within one window

I recently encountered an issue that I have never experienced before. Typically, when browsing through my folders in Internet Explorer, everything worked smoothly for me. If I included various directory links, I could easily navigate back and forth to expl ...

What is the best way to collapse additional submenus and perform a search within a menu?

Whenever a sub-menu is activated, only the current sub-menu should be open while the others remain closed. I need the search function to be enabled on the text box and display all items containing the specified value while also changing the color of <a ...

onsubmit function was never triggered

Seems like a silly mistake, but I'm encountering an issue with my HTML form. Here's a snippet of the code: <form onsubmit="updateProfile();"> <input type="submit" value="Update Account"> .. ... </form> However, w ...

Add a variety of images

Looking for help with uploading multiple images to a folder and saving paths in the database? Here's a code snippet I've been working on: The issue I'm facing is that while the image names are being saved in the database, the actual images ...

Unusual Ajax response detected by JSF ajax listener

Inside one div, there is a form containing two input text fields and a button. Upon clicking the button, the method createProject.register is triggered and the values from the input fields are saved in a database table. <h:outputText id="opt" value="# ...

Securing ASP.NET Core applications with iframe authentication cookies

I seem to be facing an issue with my iframe. Whenever I attempt to login, it appears that my authentication cookie is not functioning correctly as I keep getting redirected back to the login screen. How can I resolve this? The cookie operates normally whe ...

Tips for collapsing the navbar in Bootstrap 4

Is it possible to create a collapsible navbar in my code that will automatically collapse when viewed on mobile devices? I have attempted to add a button and set it to false, but the navbar does not display on either desktop or mobile. Below is the code ...

What is the best way to obtain the Severity value from a HKSample within the Health app?

I am looking to display headache data from the Health app. I am utilizing an array of [HKSamples] obtained from HealthStore. How can I extract the HKCategoryValueSeverity? Each sample provides access to properties like startDate, endDate, etc. The sample ...

Setting up a custom layout in Vaadin to include a text area within a table using the location attribute

For my HTML template in Vaadin, I am trying to incorporate a text area that can be used as a custom component. The HTML snippet I have is outlined below: <table> <tr> <td> JUNK SENTENCE </td> ...

Send the form using an alternative method to avoid using preventDefault

Having some trouble with my website's sign-in functionality not working properly on all browsers. In Firefox, I keep getting a "ReferenceError: event is not defined" error. I've read through various posts about preventDefault behaving differentl ...

The min-height property in CSS appears to be ineffective on Jelly Bean

In my current project developing an Android application, I have incorporated Webviews in certain activities and fragments. However, I encountered a perplexing issue when running the app on Jelly Bean (api 16 and 18) emulator - the css property min-height ...

How can one effectively replicate a flash-based application on an iPad?

This particular application is powered by flash. Is it feasible to recreate this on an iPad using cocos2d? Or would it be more effective to utilize jQuery and a WebView instead? ...

What is the best way to create a centered vertical line with text in the middle?

I attempted to replicate a form that contains a vertical line <span class="vertical-line">or</span> with text centered in it! How can I create a similar appearance like this form? I considered using hr but it generates a horizontal ...

There is excessive space beneath the text

I am struggling with aligning text vertically to match the chevrons. I have attempted various CSS properties like removing paddings/margins, setting line-height to 1, using text-decoration: none, text-align: center, and vertical-align: middle on my <p&g ...

InnerHTML failing to append HTML content

Almost at the finish line with this code! I already have a footer in place, but when the button is clicked, it smoothly slides down along with its contents. Once it's done sliding, I utilize JavaScript to swap out that footer and its contents with a n ...