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:
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...

Similar threads

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