HTML/CSS How to Create a CSS Hover Effect That Displays Text?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Hovering Text
AI Thread Summary
To create a hover effect that displays text over images in a grid layout, implement a "card with a slide-up caption" using CSS. The grid is structured with a class called "grid-container" that utilizes CSS Grid for layout, allowing for responsive design with defined gaps between items. To achieve the hover effect, include the text in the HTML source code and apply a CSS class that triggers a transition on hover. This can be accomplished by using the :hover pseudo-class to change the visibility or position of the text. Additionally, libraries like Wow.js and animate.css can simplify the implementation of these effects. For browsers like Firefox and Chrome, developers can inspect elements and toggle pseudo-classes to see the effects in real-time, aiding in the design process.
shivajikobardan
Messages
637
Reaction score
54
TL;DR Summary
How do I build component that shows some text when I hover over it?
https://practice-project-html-css.vercel.app/
1668930345844.png

I'm talking about this one.
When you hover there, it shows some text. How do I make it?
HTML:
 <div class="grid-container">
        <div class="one"><img src="project1.png" alt="" /></div>
        <div class="two"><img src="Project2.png" alt="" /></div>
        <div class="three"><img src="project3.png" alt="" /></div>
        <div class="four"><img src="project4.png" alt="" /></div>
        <div class="five"><img src="project5.png" alt="" /></div>
        <div class="six"><img src="project6.png" alt="" /></div>
        <div class="seven"><img src="project7.png" alt="" /></div>
        <div class="eight"><img src="project8.png" alt="" /></div>
        <div class="nine"><img src="project9.png" alt="" /></div>
      </div>

CSS:
.grid-container{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:40px;
  
}

Please tell me how to implement this feature.
 
Technology news on Phys.org
This is known as a "card with a slide-up caption" or more simply a "CSS hover effect". You can search for this.
 
You can give the image an alt text or title text or both, usually the same text, as some browsers display the alt text and others display the title text on hover, with no programming required by you to make it happen.

But the example you give is a css hover effect, which is shown in the source code. The text is there in the source code, and on hover it uses a class (in the html) and a transition (in the css) to slide it up.

There are useful libraries of effects such as Wow.js and animate.css that make life easier for you. Animate.css is called in the header of the sample page.
 
Last edited:
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
7
Views
2K
Replies
5
Views
2K
Replies
5
Views
2K
Back
Top