Dealing with Unintended CSS Hover Effects That Just Won't Quit

I have a div that is styled as a circular shape with an image and text centered inside of it. The circle and image are visible while the text is transparent until hovered over. When hovering, the circle border flashes, the image's opacity decreases, and the text becomes visible.

Testing this code in Firefox works perfectly as intended, but in Chrome, the hover effects persist even after moving the cursor away (the image remains dimmed and the text stays visible). Hovering back on the div makes the border flash correctly.

Although I have included all the necessary webkit/moz/ms/o transitions and animations, there seems to be an issue specifically with Chrome. Any suggestions on how to fix this inconsistency?

The code for the div and its elements is:

<div class='players'>
    <div class='row'>
        <div class='span6'>
            <div class='matchup'>
                <p class='team'>SOMETEAMNAME</p>
                <p class='name'>SOMENAME</p>
                <img src='SOMEIMAGE'>
            </div>
        </div>
    </div>
</div>

The CSS code used:

.matchup {
    width: 250px;
    height: 250px;
    background: transparent;
    border: 1px solid #ff6600;
    border-radius: 125px;
    display: block;
    margin-left: auto;
    margin-right: auto;

    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
    -o-box-sizing: border-box;
    box-sizing: border-box;

    -webkit-transition: 0.5s ease;
    -moz-transition: 0.5s ease;
    -ms-transition: 0.5s ease;
    -o-transition: 0.5s ease;
    transition: 0.5s ease;
}
.matchup img {  
    position: static;
    margin-top: -22%;
    opacity: 1;

    -webkit-transition: 0.5s ease;
    -moz-transition: 0.5s ease;
    -ms-transition: 0.5s ease;
    -o-transition: 0.5s ease;
    transition: 0.5s ease;
}
.matchup p {
    font-family: 'Lobster', cursive;
    position: relative;
    text-align: center;
    top: 50%;
    color: transparent; 

    -webkit-transition: 0.5s ease;
    -moz-transition: 0.5s ease;
    -ms-transition: 0.5s ease;
    -o-transition: 0.5s ease;
    transition: 0.5s ease;
}
.team {
    font-size: 25px;
}
.name {
    font-size: 45px;
}
.map {
    font-size: 15px;
    margin-top: -70%;
}
.matchup:hover {
    -webkit-animation: matchup-active 1s infinite;
    -moz-animation: matchup-active 1s infinite;
    -ms-animation: matchup-active 1s infinite;
    -o-animation: matchup-active 1s infinite;
    animation: matchup-active 1s infinite;

    p {
        color: #ff6600;
    }
    img {
        opacity: 0.2;
    }
}

@-webkit-keyframes matchup-active {
    0% {
        border: 1px solid #ff6600;
    }
    50% {
        border: 1px solid transparent;
    }
    100% {
        border: 1px solid #ff6600;
    }
}
@-moz-keyframes matchup-active {
    0% {
        border: 1px solid #ff6600;
    }
    50% {
        border: 1px solid transparent;
    }
    100% {
        border: 1px solid #ff6600;
    }
}
@-o-keyframes matchup-active {
    0% {
        border: 1px solid #ff6600;
    }
    50% {
        border: 1px solid transparent;
    }
    100% {
        border: 1px solid #ff6600;
    }
}
@keyframes matchup-active {
    0% {
        border: 1px solid #ff6600;
    }
    50% {
        border: 1px solid transparent;
    }
    100% {
        border: 1px solid #ff6600;
    }
}

UPDATE: A jsfiddle link has been added for reference: http://jsfiddle.net/sicophrenic/qvJ94/. Please note that it may not be perfectly styled, but the issue with Chrome can be observed while it works fine in Firefox.

Answer №1

When targeting the .matchup class, include color:transparent;

To apply a different color on hover for .matchup, use color: #ff6600;

For nested paragraphs within .matchup, set color: inherit;

Note that using .matchup:hover p as a selector is not valid.

Check out this fiddle for reference

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

Creating a simple bootstrap code for developing plugins in Wordpress

After successfully coding in Brackets with the Theseus plugin on my local machine, I encountered a problem when attempting to transfer my code to a Wordpress installation. The transition from Brackets to Wordpress seems far more complicated than expected. ...

Generate an image of a "button" with dynamic hover text

I am trying to create a clickable image with dynamically changing text overlaid on it. I have the PHP code that retrieves the necessary information for the text, but I am struggling to create the button as I am new to this type of task. Here is an example ...

Tips for optimizing Jquery selectors to streamline recurring functions

I have 9 "service node" divs in my HTML code, each containing a hidden div and a button that triggers the rotation of the button by 45 degrees and reveals the hidden div. The challenge I am facing is that I have been using repetitive functions for each ser ...

What is the best way to handle the select event for a jQuery UI autocomplete when there are images involved?

Looking for help with creating an autocomplete feature with images on this jsfiddle. Despite trying to capture the event when a user selects an image, it doesn't seem to work properly: $("#input").autocomplete({ //source: tags, so ...

Div Boxes at the Center

I've searched extensively for a solution to my unique problem, but haven't been able to find one that fits. I have 4 div boxes with a max width of 50% and a min width of 400px. When the site is viewed on a smaller screen, I want the boxes to alig ...

Is there a way to utilize jQuery to redirect to the href included in the HTML attachment?

I am looking to add a redirection feature to my website using the href provided in the code by jQuery. This will be done after playing an animation for better user experience. $(document).ready(function(){ $("a").click(function(event){ event.prev ...

The powers of jQuery and CSS selectors

Previously, I utilized the following code to extract text from the data-placeholder attribute and apply it as a placeholder for my div. [contentEditable=true]:empty:not(:focus):before { content:attr(data-placeholder) } While this method worked well b ...

Tips for Positioning a Page Layout in the Center Using HTML and CSS

I'm a beginner in HTML and CSS and I'm trying to create a simple webpage layout from scratch. I want all the elements of the page (nav, header, section, footer, etc.) to be centered while still keeping the nav bar on the left side. I've set ...

Pointer-events property in pseudo elements not functioning as expected in Firefox browser

I have a horizontal menu that includes mid-dots (inserted using the ::after pseudo element) to separate the menu items. I want to prevent these mid-dots from being clickable. This works fine in Safari, but in Firefox (v.47), the pointer-events: none prope ...

Experiencing an issue while rendering due to the presence of display: table-cell;

I am currently in the process of developing a website. The HTML Header section is structured as follows: <div id="page"> <header> <a href="#" class="redsquare">&nbsp;</a> <div class="head-wrapper"> ...

What steps can I take to address the div issue in my React application?

After implementing Browser Router, I am encountering whitespace on the left and right side of the navbar. How can I resolve this issue? Below is the code snippet: <div className="container my-3"> <BrowserRouter> ...

Having trouble implementing absolute css positioning on my custom composite button

I encountered a peculiar issue that I have managed to work around, but I am still curious about why it is happening. Below is the code for my Composite class: import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.clie ...

Issues with the Webdriver MoveToElement function have been reported in Internet Explorer and Firefox specifically related to retrieving text tooltips

I have attempted to use MoveToElement in order to retrieve the tooltip of a specific element. This method works successfully in Chrome. However, when I try to do the same in IE10 and Firefox 26.0, it only hovers over the element for a brief moment, not all ...

Is there a way to create a layout with a row containing two columns and another row with just one column using MUI Grid?

Is it possible to achieve the design displayed in the image using MUI components? I am facing an issue where I am unable to properly insert a third Button into the MUI grid with the same width as the other two buttons. Any suggestions on how to solve this ...

Stop the WebGL Three.js container from capturing scroll events

I am working on a full-screen three.js application which serves as the background and I am trying to add overlaid text that can be scrolled. However, my issue arises from the fact that the three.js WebGL container intercepts all scroll events and prevents ...

What is the best way to completely eliminate a div from a webpage

I've created a new div element using jQuery: $(document.body).append('<div id="test"></div>'); Then, I display a success message and remove the div after 10 seconds: $('test').html('SUCCESS!'); setT ...

The CSS Grid container fails to resize based on the content inside

I am facing an issue with the grid element inside a parent container with display: grid;. The parent container has a maximum size and allows scrolling for the grid if necessary. The problem is that the grid element does not expand to fit its children. Whe ...

How can I hover over multiple cells in a table?

Is there a way to change the color of multiple adjacent cells when hovering over one cell, and can this be done dynamically (so the number of adjacent cells that change color can vary)? Here is the code snippet: I'm using React to create a table wit ...

Adjusting the width of a div element horizontally in Angular 4 and

As someone new to Angular 4, I've been attempting to create a resizable div (horizontally) without success. My goal is to be able to click and drag a grabber to resize the text area horizontally. However, in the example provided in the link below, the ...

The alignment of flexNav.js submenus is not consistent

I'm looking to implement the Flex Navigation plugin for a responsive menu. Although the plugin functions properly, I'm encountering an issue with the alignment of submenus under their respective parent items. You can view the problematic behavi ...