CSS Opacity on Hover of Div

How to change the opacity of image on hover using css

Your code is good- verified in this Fiddle with a friendly fish: http://jsfiddle.net/Qrufy/

    img {        opacity: 0.5;        filter: alpha(opacity=40);    }        img:hover {        opacity: 1.0;        filter: alpha(opacity=100);    }
    <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Colossoma_macropomum_01.jpg/800px-Colossoma_macropomum_01.jpg" />

CSS3 hover opacity ease-in-out effect?

Don't repeat the transition rules. CSS pre-processors can help with the vendor prefixing but you really don't need to (and shouldn't) repeat the transition declarations in the :hover. Just set them once in elements's default state like so:

.button-hover {    font-family: arial black;    font-size: 100px;    color: #000;    -webkit-transition: opacity 1s ease-in-out;    -moz-transition: opacity 1s ease-in-out;    -ms-transition: opacity 1s ease-in-out;    -o-transition: opacity 1s ease-in-out;    transition: opacity 1s ease-in-out;    opacity: 1;}
.button-hover:hover { opacity: 0.5;}
<div class="container">    <a href="#" class="button-hover">HOVER ME</a></div>

CSS Making a div change opacity, lightness when hovered over

The flicker you're seeing is caused by setting pointer-events:none; on the hover property.

You're telling the browser to ignore all pointer events, even the ones that trigger hover states. So the moment you activate the hover css you deactivate it, causing the flicker (it's updated by mouse pixel movement).


.divhover:hover {
background-color: hsla(0, 100%, 100%, 0.0);

Update: If your ultimate goal is to simply grey out the text until you hover over it, then you might try this:

Working Demo


<div class="hover">    
<p> xtext <a>xlink</a> </p>
<p> xtext <a>xlink</a> </p>


.hover {
opacity: .5;

opacity: 1;

I think you may be going about this effect in an odd way. You can add a hover state on the containing element and toggle the opacity.

change opacity of one div by hovering over another div

Use the :hover pseudo selector on .songs, but then target .songtitles and change its opacity:

.songs:hover .songtitles {
opacity: 1;


How to set separate opacity for hover element and its tooltip?

I tend to avoid opacity:val since it applies to every part of an element AND all children of the element.

In your case you have a few options:

  1. Remove the tooltip from the element that gets an opacity change
  2. Add a wrapper inside the hovered element and only change the opacity on that element and it's children.
  3. Simulate opacity by using rgba (alpha) on backgrounds, borders, etc but you'll have to change each of those attributes separately.

Opacity when hovering DIV or other Element

You can set a class to the <p> or just, use an operator to set the :hover to paragraph.


#testHdiv:hover > p {
opacity: 1;


Related Topics

Leave a reply