I am doing a page where I show thumbnails for videos that, when you click, it popups a YouTube video.
This thumbnails are simple images of 195x195 but the end client it will upload as it, and I would like to add via CSS a "play icon" over the image of the video (compatible with IE7+). I've no idea on how to handle this.
Can anyone help me?
Thank you in advance!
Basically, you put both of your images in the same container. Give the container a position that isn't static (in my example, relative). Then give the overlay image position: absolute and position it however you want using bottom and right . Show activity on this post.
Use two <div> elements for the original image and overlay image. Add another <div> for the overlay image inside the second one.
Wrap the images in a <div> with the overlay image first and the actual image second, and can set the css of the div to position: relative . The two images can then be given the css {position: absolute; top: 0; left: 0;} . If you really want to be safe, you can set the z-index of each image.
you might want to do something like this:
<div class="imageWrapper" style="position: relative; width: 195px; height: 195px;">
<img src="/path/to/image.jpg " alt=.. width=.. height=..style="position: relative; z-index: 1;" />
<img src="/path/to/play.jpg " alt=.. width=.. height=.. style="position: absolute;left:80px; top: 80px;z-index: 10;" />
</div>
of course do not use style=""
, but put styles into separate CSS files.
Explanation:
put two images into div. If you give position: relative;
property to your wrapper div, then anything inside this div would be position relatively to it. It means, you can add position: absolute;
to the play image and using left: XXpx;
and top: XXpx;
you can position it where you want. You might want to use z-index
to define which picture should be on the top. The higher z-index
the higher layer. Please note: z-index
works only if position
is set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With