
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create an image overlay title on hover with CSS?
Following is the code to create an image overlay title on hover using CSS −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> * {box-sizing: border-box;} .card-container { position: relative; width: 50%; } .image { display: block; width: 100%; height: auto; } .overlay { position: absolute; bottom: 0; background: rgba(48, 9, 155, 0.5); width: 78%; transition: .5s ease; opacity:0; color: rgb(251, 255, 0); font-size: 25px; font-weight: bolder; padding: 20px; text-align: center; } .card-container:hover .overlay { opacity: 1; } </style> </head> <body> <h2>Image Overlay Title Example</h2> <div class="card-container"> <img src="https://i.picsum.photos/id/237/536/354.jpg" > <div class="overlay">Dog</div> </div> </body> </html>
Output
The above code will produce the following output −
On hovering over the image the caption will be shown as bottom −
- Related Questions & Answers
- How to create an image overlay zoom effect on hover with CSS?
- How to create image overlay icon effect on hover with CSS?
- How to create image overlay hover effect with CSS?
- How to create image overlay hover slide effects with CSS?
- How to create an overlay effect with CSS?
- How to display an element on hover with CSS?
- Display a blue shadow on image hover with CSS
- How to zoom/scale an element on hover with CSS?
- Create a transition effect on hover pagination with CSS
- How to create an image gallery with CSS
- How to create an avatar image with CSS?
- How to add transition on hover with CSS?
- How to overlay text on an image using JIMP in NodeJS?
- Overlay an image segmentation with Numpy and Matplotlib
- Fade in on Button hover with CSS
Advertisements