Issues with IE9's CSS hover functionality are causing problems

This particular css style functions well on most browsers, but seems to have compatibility issues with Explorer 9 specifically when it comes to the :hover effect. There are instances where it works perfectly fine and other times when it doesn't work at all.

.navSubMenu .mainMenuContent .programItem:hover a.hoverGreen { color: #b3dd0c;  }
.navSubMenu .mainMenuContent .programItem:hover a.hoverWhite { color: #fff; }
.navSubMenu .mainMenuContent .programItem a.hoverWhite:hover { color: #b3dd0c;  } 
.navSubMenu .mainMenuContent .programItem:hover a.hoverRed { color: #A80000; }

Here is the corresponding HTML code:

<div class="mainMenuContent">
                            <div class="mainMenuContentWrapper">
                                <Adam:Repeater ID="Rpt_Programs" runat="server" DataItemTypeName="Reshet.Objects.ObjectInfo">
                                    <ItemTemplate>
                                        <div class="programItem">
                                            <a href="<%#Container.DataItem.Link.HeyperJustLink() %>">
                                                <%#Container.DataItem.MediaMedium %>
                                                <div class="programTitle">
                                                    <%#Container.DataItem.Name%></div>
                                                <a href="<%#Container.DataItem.Link.HeyperJustLink()%>" class="hoverGreen">לאתר</a>
                                                <span class="divider"></span><a href="<%#Container.DataItem.ItemLink.HeyperJustLink() %>"
                                                     class="hoverWhite">לפרק האחרון</a>
                                                <div class="addToFavWrapper">
                                                    <%-- <img class="addToFavBtn" src="<%=SiteUrl %>/images/n_Images/Headers/plus_normal.png" alt="">
                                    <img class="addToFavBtn_over" src="<%=SiteUrl %>/images/n_Images/Headers/plus_over.png" alt="">--%>
                                                </div>
                                        </div>
                                    </ItemTemplate>
                                </Adam:Repeater>
                            </div>
                            <a href="<%=SiteUrl %>/Shows/VOD/" class="allBtn greenBtn">לכל התוכניות</a>
                        </div>

Upon hovering over the div element, the hover effect sometimes triggers and sometimes does not, resulting in inconsistency and occasional stacking which requires moving the mouse again to release the effect properly. It's clear that this implementation is not functioning as intended.

Answer №1

Your code is missing a closing tag for the first <a> element inside the .programItem class:

<div class="programItem">
    <a href="<%#Container.DataItem.Link.HeyperJustLink() %>">

Additionally, you are selecting

.navSubMenu .mainMenuContent .programItem:hover a.hoverGreen
, but there is no parent element with the class .navSubMenu in your HTML structure.

Answer №2

For a solution, consider implementing a strict HTML 4 doctype as outlined in this source:

While the article mentions IE7, it's worth noting that this workaround has successfully resolved the issue for users experiencing similar problems in IE9.

Answer №3

It is important that you reposition :hover onto the a elements. Here is an example:

.navSubMenu .mainMenuContent .programItem a.hoverGreen:hover { color: #b3dd0c; }
.navSubMenu .mainMenuContent .programItem a.hoverWhite:hover { color: #fff; }
.navSubMenu .mainMenuContent .programItem a.hoverWhite:hover { color: #b3dd0c; } 
.navSubMenu .mainMenuContent .programItem a.hoverRed:hover { color: #A80000; }

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

Styling animations in React with inline styles

Exploring the world of React inline animation styling, I set out to create a toggle button. The goal was simple: when the user presses the button for the first time, I wanted a pop-up animated card to slide from left to right. On the second press, the card ...

Developing components through JavaScript

I am attempting to use JavaScript to create an element in my HTML using createElement, but there seems to be an issue in my code. HTML <button class="test_button">I am a test</button> <div class="test"></div> ...

Utilize AJAX to showcase JSON data retrieved from a specified URL

We are striving to showcase the names listed in our JSON file within a div using JavaScript. Despite multiple attempts, we have not yet achieved success. JSON data: This is the approach we took: <button>fetch data</button> <div id="result ...

Sending JavaScript variables to an external CSS file

I've been searching for a solution without much luck. I must admit, my CSS skills are pretty basic. Currently, I am using Muxy.io to manage notifications for my livestreams. The platform allows customization of notifications through HTML and CSS file ...

What methods can I utilize to increase the speed of my JavaScript animation?

Recently, I implemented a Vue component designed to loop a div over the X axis. While it functions correctly, I can't help but notice that it is consuming an excessive amount of CPU. I am interested in optimizing this animation for better performance. ...

The animation isn't loading

I discovered a handy script that displays a waiting message when my form is submitted. I implemented jquery-ui to showcase this message in a dialog box, and it was successful. However, upon customizing the text and adding an animated gif background using C ...

Are there specific elements that fall under the umbrella of CSS?

Code is causing some red boxes to appear unexpectedly. User agent: Chrome/80.0.3987.149 Linux x86_64 Here is the code snippet: <html lang="en"> <head> <meta charset="utf-8"> <title>Flow</title> ...

What is the best way to add all the items from an array to a div element?

I am currently facing an issue where only the last object in my array is being added to my div using the code below. How can I modify it to add all objects from the array to my div? ajaxHelper.processRequest((response: Array<Vehicle.Vehicle>) ...

Pass various chosen checkboxes to Java by utilizing jQuery and Ajax technology

I am struggling with sending multiple selected checkboxes from HTML to Java using jQuery/Ajax. The issue is that when I check the result in Java, instead of getting the values I selected (e.g., National, State), I get "activityRangeCBs[]". Here is the HTM ...

Tips for adjusting large resolution images to fit all screen sizes without exceeding the boundaries of the screen

I am in the process of creating a set of HTML pages specifically tailored for iPad Air and iPad Mini. These pages will feature several large images, with dimensions such as 1600x300. However, upon testing in Windows browsers, I encountered an issue where t ...

Steps for adding a div after a specified number

To display the following div after getting a value greater than or equal to the specified value and retrieving it through ajax: 1. How can I show the below div with the given value? .mainbox{ width:auto; height:auto; padding:20px; background:#f00; } .i ...

The full height of the image cannot be captured by html2canvas

It baffles me that html2canvas is failing to capture the full height of the div. html2canvas($container, { height: $container.height(), onrendered: function(canvas) { var data = canvas.toDataURL('image/png'); ...

Tips on crafting tailored CSS styling for targeted div elements such as before and after:

Looking to style specific div elements with the same class name? <div class="main"> <div class="banner_image"> banner 1</div> <div class="banner_image ">banner 2</div> <div class="banner_image ">banner 3</di ...

When you have a target element that is deeply nested, consider using a 50% height relative to

There is some confusion surrounding the issue below: <div class="container"> <div class="row"> <div class="group"> <a> <div class="col-lg-3 full-h"></div> </a> <a> < ...

Switching from HTML to BBCode during the editing process

My issue lies in converting BBCode to HTML and then editing the code on a page with AJAX. When editing in a <textarea>, the HTML tags show up instead of the original BBCode. For instance, if I submit [b]bold text[/b] and save it to my database, the ...

Having trouble with jQuery hover and AJAX loaded content not functioning properly?

When I receive content through AJAX, it looks like this: <div class="message" id="1"> blah <div class="details" id="1" style="float: left; display: none;">hidden information</div> <div class="spacer" style="clear: both;"&g ...

Tips for showing JSON data within multiple <div> elements on an HTML page with AngularJS and ng-repeat

I am looking to display JSON values on my HTML page, each in a separate div based on the image URL value from the .json file. However, I am encountering difficulties in displaying these values in the divs. Can someone please guide me on how to iterate and ...

Please disable zoom functionality on the website specifically for Android devices

Is there a way to disable the zoom feature on our website specifically for Android phones/devices without affecting iPhones? Perhaps targeting the Chrome browser on Android would be sufficient, but we should also verify the mobile screen size. ...

What is the best way to incorporate an exception for the printThis() element?

Is there a way to exclude a specific div from being printed when using the printThis() function? For example: <div id="print-it"> <div>hello</div> <div id="no-print-this"> <button>must be show on page but not print</but ...

Tips for automatically resizing a canvas to fit the content within a scrollable container?

I have integrated PDF JS into my Vue3 project to overlay a <canvas id="draw_canvas"> on the rendered pdf document. This allows me to draw rectangles programmatically over the pdf, serving as markers for specific areas. The rendering proces ...