Create hover text on image with CSS

We've already seen how to create an element that is displayed when the mouse hovers over an image, but in this article we'll show you how to display a whole host of information very fluidly by hovering the mouse over an element!
•
Updated on August 14, 2026
•
3 min read
Believemy logo

We've already seen how to create an element that appears when hovering the mouse over an image, but in this article, here's how to display a bunch of information in a very smooth way by hovering over an element!

The entire tutorial is also available on our Instagram account.

 

Step 1

The HTML code.

HTML
<div class='card'>
      <div class='info'>
        <h1 class='title'>Tokyo</h1>
        <p class='description'>Tokyo, the vibrant capital of Japan, combines ultra-modern and traditional styles in a mix of skyscrapers with bright neon lights and ancient temples. The sumptuous Meiji-jingū is a Shinto shrine renowned for its imposing entrance and surrounding woods. The Imperial Palace is surrounded by vast public gardens. The city's numerous museums offer exhibitions ranging from classical art at the National Museum of Tokyo to a reconstructed kabuki theater and the Edo-Tokyo Museum.</p>
      </div>
    </div>

Each element of the timeline has its own timeline-object.

 

Step 2

Let's style the card.

CSS
.card {
      border-radius: 16px;
      margin: 0 auto;
      width: 500px;
      max-width: 100%;
      min-height: 500px;
      box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2);
      overflow: hidden;
      background-image: url(https://cdn.pixabay.com/photo/2019/04/20/11/39/japan-4141578_960_720.jpg);
      background-size: cover;
    }

 

Step 3

Let's tackle the div containing the information.

CSS
.info {
      position: relative;
      width: 100%;
      height: 500px;
      background-color: #fff;
      transform: translateY(100%)
        translateY(-88px)
        translateZ(0);
      transition: transform 0.3s ease-out;
    }

 

Step 4

Let's add a background to the div containing the information.

CSS
.info:before {
      z-index: -1;
      display: block; position: absolute;
      content: ' ';
      width: 100%; height: 100%;
      overflow: hidden;
      background-image: url(https://cdn.pixabay.com/photo/2019/04/20/11/39/japan-4141578_960_720.jpg);
      filter: blur(10px);
      background-size: cover;
      opacity: 0.25;
      transform: translateY(-100%)
        translateY(88px)
        translateZ(0);
      transition: transform 0.3s ease-out;
    }

Here, we style the background of the div containing the information using :before.

This allows us to add a background that covers the entire height and width of the div, while giving us the ability to blur it with the blur filter.

 

Step 5

Let's style the title and the description.

CSS
.title {
      margin: 0;
      padding: 24px;
      font-size: 40px;
      line-height: 1;
      color: rgba(0, 0, 0, 0.87);
    }
    
    .description {
      margin: 0;
      padding: 0 24px 24px;
      font-size: 18px;
      line-height: 1.5;
    }

 

Step 6

Now we just need to detect the hover over the card to complete this code!

CSS
.card:hover .info,
.card:hover .info:before {
      transform: translateY(0) translateZ(0);
    }

 

Conclusion

That's how you can create text that appears on hover! If you want to make it even simpler and you're wondering: how to make text appear when hovering over an image? Just add the title="text to be displayed" attribute to your img tag.

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating a hovered with CSS

In this tutorial we'll look at how to create an overlay easily using CSS!

December 9, 2024

Create a very modern hover on a link

Here's an easy way to create a very modern hover on a link! There are lots of possible effects for buttons and links: the better they look, the more likely your users will be to click on them.

December 9, 2024

Create a glitch effect on mouse-over with CSS

Add a modern glitch effect to your presentations or your logo, whether it's hovering or permanent! Let's find out how.

December 9, 2024

Creating circled buttons on hover with HTML and CSS

For a menu or to encourage your readers to share your website, share buttons are essential elements to add to your website. Let's find out how to make them more modern with a "neon" effect that will surround the icon selected by your user.

December 9, 2024

Creating an animated list with CSS

Let's find out how to create an animated hover list!

December 9, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

December 9, 2024

Create a map displaying links on mouse-over with CSS

To present your team or simply yourself, this animation will allow you to display the links to your social networks when you hover over the map: a striking effect guaranteed! Let's find out how to do it together.

December 9, 2024

Make an arrow that expands when hovered over with CSS

Whether it's to make your users want to see your project, read your article or access a page on your website, presenting your link with an arrow will make it easier to catch your visitors' eye! Let's find out in this article how to animate this arrow to enhance your readers' experience.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.