How can I create this transparent image overlay on hover using CSS?


Forest

I'm looking for suggestions to reproduce my image hover effect ( see this image ). My problem is that my images are fluid and I can't really find any good tutorials on the subject and overlays.

I'm assuming I have to create a transparent png (white area + circle), hover it over the image, and overlay the text on it? And all of this needs to be adjusted accordingly based on the image itself. Also, the top border is not part of the image, it's generated by CSS and I don't want to override it if possible.

Can anyone point me in the right direction, or if there is a better way to implement it, please advise? I am very lost.

Thank you in advance. :)

halide

If the image is going to be contained in a div with a defined width, you can add an absolutely positioned div to the containing div that will serve as an overlay. Assume this code snippet and the opacity of the overlay is set to zero

<div class="picholder">
    <img class="fancypics" src=http://placehold.it/500x650></img>
    <div class="overlay"><p class="text_box">Hello World!</p></div>
</div>

The css for the hover effect will be

.picholder:hover .overlay{opacity:1;}
.picholder:hover .fancypics{opacity:0.7;}

I'm sure you'll do that, which should give the hover effect. The following CSS should center the overlay and a few other things. See here for more info on centering divs both vertically and horizontally

.overlay {
  bottom: 0;left: 0; top: 0; right: 0;
  height: 150px;
  width: 150px;
  margin: auto;
  position: absolute;
  background-color:#3f3f3f;
  border-radius: 50%;
  opacity:0;
}
.fancypics{width:100%;}
.text_box{
  color:white;
  weight:bold;
  font-size:2em;
  padding:10px;
  padding-bottom:50%;
  text-align:center;
}

And of course the violin

Related


How can I set a transparent border around an image using CSS?

microphone I'm trying to create an oval shape on hover when someone hovers over a link. By doing this, I lost the image that was part of the link. I know what I'm doing wrong but what? .pagelinks { float: right; margin-right: 48%; display: inline-block;

How can I set a transparent border around an image using CSS?

microphone I'm trying to create an oval shape on hover when someone hovers over a link. By doing this, I lost the image that was part of the link. I know what I'm doing wrong but what? .pagelinks { float: right; margin-right: 48%; display: inline-block;

How can I create a transparent border using CSS in a subclass?

microphone I'm trying to create a transparent border around the page number 1 shown below the image. I created a subclassed span tag so that I can just target the element, but it doesn't seem to work. I found some similar questions saying to create a space in

Overlay image on hover using only CSS

Zen I'm trying to overlay an image with a smaller image that has the background opacity of the first image on hover, using only css as I can't edit the html. Here is a sample HTML: <div class="image"> <a href="http://www.example.com"> <img src="/uploads/

Overlay image on hover using only CSS

Zen I'm trying to overlay an image with a smaller image that has the background opacity of the first image on hover, using only css as I can't edit the html. Here is a sample HTML: <div class="image"> <a href="http://www.example.com"> <img src="/uploads/

How to overlay on image on hover?

Zafar Gilfanov I have a div with img in it. Div's borders are strong. When hovering the overlay image, I need the div to be the background and the overlay should have text in the center. Here is my code: <div class="picture"> <a href="product-link"><img sr

How to overlay on image on hover?

Zafar Gilfanov I have a div with img in it. Div's borders are strong. When hovering the overlay image, I need the div to be the background and the overlay should have text in the center. Here is my code: <div class="picture"> <a href="product-link"><img sr

How to overlay on image on hover?

Zafar Gilfanov I have a div with img in it. Div's borders are strong. When hovering the overlay image, I need the div to be the background and the overlay should have a text in the center. Here is my code: <div class="picture"> <a href="product-link"><img

How to overlay on image on hover?

Zafar Gilfanov I have a div with img in it. Div's borders are strong. When hovering the overlay image, I need the div to be the background and the overlay should have a text in the center. Here is my code: <div class="picture"> <a href="product-link"><img

CSS color overlay on image hover

almost a developer I tried other answers, but none of them worked with my specific setup. I can't use any ul/li settings, so please don't suggest. I'm trying to get a slightly transparent orange layer to show over an image. I can't use absolute positioning, th

CSS color overlay on image hover

almost a developer I tried other answers but none of them worked with my specific setup. I can't use any ul/li settings, so please don't suggest. I'm trying to make a transparent orange layer show over an image. I can't use absolute positioning, the site is bu