Simple CSS Card with Hover Effects

Simple CSS Card with Hover Effects
Code Snippet:RESPONSIVE CARDS CSS TWITTER + INSTAGRAM + YOUTUBE
Author: Mohamed Yousef
Published: January 20, 2024
Last Updated: January 22, 2024
Downloads: 4,281
License: MIT
Edit Code online: View on CodePen
Read More

This HTML & CSS code snippet helps you to create a responsive card with captivating hover effects.  When you hover over these cards, they undergo a color transformation, providing an engaging visual feedback experience.

You can integrate these cards into your project to showcase products, services, or team members. Similarly, you can arrange your content inside these cards to make your website appearance more appealing.

How to Create Simple CSS Card with Hover Effects

1. First of all, load the Font Awesome CSS by adding the following CDN link into the head tag of your HTML document. (Optional)

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>

2. Create the HTML structure for your responsive cards. You can use the following HTML code as a template. Replace the card’s content with your own. Likewise, change the Font Awesome icon class, title, description, and link as needed.

<div class="cards">
         <h2 class="header">
            Responsive Cards CSS
         </h2>
         <div class="services">
            <div class="content content-1">
               <div class="fab fa-twitter"></div>
               <h2>
                  Twitter
               </h2>
               <p>
                  Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
               </p>
               <a href="#">Read More</a>
            </div>
            <div class="content content-2">
               <div class="fab fa-instagram"></div>
               <h2>
                  Instagram
               </h2>
               <p>
                  Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
               </p>
               <a href="#">Read More</a>
            </div>
            <div class="content content-3">
               <div class="fab fa-youtube"></div>
               <h2>
                  Youtube
               </h2>
               <p>
                  Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
               </p>
               <a href="#">Read More</a>
            </div>
         </div>
      </div>

3. Finally, let’s apply the following CSS code to style our cards. Make sure to save this CSS code in a file called styles.css and link it in the HTML file.

@import url('https://fonts.googleapis.com/css?family=Montserrat:400,800|Poppins&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat',sans-serif;
}
.cards{
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  padding: 30px;
}
.cards h2.header{
  font-size: 40px;
  margin: 0 0 30px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.services{
  display: flex;
  align-items: center;
}
.content{
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  margin: 20px;
  padding: 20px;
  border: 2px solid black;
  border-radius: 4px;
  transition: all .3s ease;
}
.content .fab{
  font-size: 70px;
  margin: 16px 0;
}
.content > *{
  flex: 1 1 100%;
}
.content:hover{
  color: white;
}
.content:hover a{
  border-color: white;
  background: white;
}
.content-1:hover{
  border-color: #1DA1F2;
  background: #1DA1F2;
}
.content-1:hover a{
  color: #1DA1F2;
}
.content-2:hover{
  border-color: #E1306C;
  background: #E1306C;
}
.content-2:hover a{
  color: #E1306C;
}
.content-3:hover{
  border-color: #ff0000;
  background: #ff0000;
}
.content-3:hover a{
  color: #ff0000;
}
.content h2{
  font-size: 30px;
  margin: 16px 0;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.content p{
  font-size: 17px;
  font-family: 'Poppins',sans-serif;
}
.content a{
  margin: 22px 0;
  background: black;
  color: white;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid black;
  padding: 15px 0;
  border-radius: 25px;
  transition: .3s ease;
}
.content a:hover{
  border-radius: 4px;
}
@media (max-width: 900px) {
  .services{
    display: flex;
    flex-direction: column;
  }
}

The above CSS code includes hover effects. When you hover over a card (e.g., .content-1), it will change its background color and text color to create an interactive effect. Customize the colors according to your design preferences.

That’s it! You’ve created responsive CSS cards with hover effects for your website. If you have any questions or suggestions, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X