Card with Hover Details using CSS
Hello Guys! In this blog, I'm going to explain to you how to make a card with hover details using CSS. This will be a step-by-step guide including HTML and CSS. Let's get started 🚀.
Let's cover the HTML part
HTML is a markup language. We use HTML to make the skeleton of a website.
Now let's import the font awesome CDN in our HTML head tag. fontawesome is a library that is used for icons in a website.
Now let's import the fonts using Google Fonts API. Below is the code for Poppins Font. Paste the below code in head tag.
Now let's design the container in our ` ` tag. In the below HTML code, we have created a container that contains the div which is an image card, in that card we have a details div which holds the heading and details of the card.
Here is the Final HTML Code
Output Till Now
Let's understand CSS Part
In the below CSS code,
- We declare a * selectors to set the font Poppins that we have imported in our head tag.
- Next we declare a body selector which consists of styles for dark mode and aligns all elements in the body to the center.
- Next, we have a card that has a background property for our card image, border-radius property for rounded corners, height, width, z-index, flex, etc. basic properties.
- Next, we use the `transform: scale(1.3);` property to make a zoom effect on the image on hover.
- Next, we use the linear-gradient property on the background to make a shadow effect at the bottom of the details.