Overview
This project showcases a collection of service cards with hover effects using HTML and CSS. The design emphasizes simplicity, responsiveness, and engaging hover transitions. Below is a concise breakdown of the project’s components and design considerations
This project features a series of service cards designed with hover effects to enhance user interactivity and engagement. Each card represents a specific service category and displays relevant icons, titles, descriptions, and a call-to-action button.
Project Functionality
- Technology Usage: HTML5, CSS3
- External Resources: Font Awesome, Google Fonts
- Responsive: Yes
Source Code & Live Demo
To use this project source code effectively:
- Source Code: You can obtain the complete source code by copying the code provided below.
- Download: You can download the source code by clicking the Source Code button below to get a ZIP file of the project. Extract the contents to your desired directory.
- Open the Project: Open the project folder using a text editor or an integrated development environment (IDE) like Visual Studio Code.
- Modify and Experiment: Customize the content, styles, and functionalities to suit your preferences. Experiment with different designs to enhance your learning.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>service card hover effects</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<!-- main container -->
<div class="main-container">
<h2 class="container-header">service card hover effect</h2>
<!-- service card start -->
<div class="service-card">
<!-- card one -->
<div class="card">
<div class="brand-icon">
<i class="fa-brands fa-uikit"></i>
</div>
<div class="card-body">
<h3 class="card-header">ui/ux design</h3>
<p class="detail">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat
eveniet, id reiciendis cupiditate ratione dignissimos esse
possimus rem ipsam porro.
</p>
<button class="card-btn">learn more</button>
</div>
</div>
<!-- card one -->
<div class="card">
<div class="brand-icon">
<i class="fa-brands fa-facebook-f"></i>
</div>
<div class="card-body">
<h3 class="card-header">facebook markating</h3>
<p class="detail">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat
eveniet, id reiciendis cupiditate ratione dignissimos esse
possimus rem ipsam porro.
</p>
<button class="card-btn">learn more</button>
</div>
</div>
<!-- card one -->
<div class="card">
<div class="brand-icon">
<i class="fa-brands fa-meta"></i>
</div>
<div class="card-body">
<h3 class="card-header">meta markating</h3>
<p class="detail">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat
eveniet, id reiciendis cupiditate ratione dignissimos esse
possimus rem ipsam porro.
</p>
<button class="card-btn">learn more</button>
</div>
</div>
<!-- card one -->
<div class="card">
<div class="brand-icon">
<i class="fa-brands fa-instagram"></i>
</div>
<div class="card-body">
<h3 class="card-header">instagram page</h3>
<p class="detail">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat
eveniet, id reiciendis cupiditate ratione dignissimos esse
possimus rem ipsam porro.
</p>
<button class="card-btn">learn more</button>
</div>
</div>
</div>
<!-- service card end -->
</div>
</body>
</html>
@import url("https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap");
/* #a0a0b4 */
/* #f3f3f3 !important */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
list-style: none;
text-decoration: none;
font-family: "Rubik", sans-serif;
}
body {
background-color: #f3f3f3;
}
.main-container {
min-height: 100dvh;
width: max(350px, 80%);
margin: 0 auto;
display: flex;
gap: 80px;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container-header {
text-transform: uppercase;
text-align: center;
font-weight: 800;
font-size: calc(0.5vw + 20px);
margin: 30px 0 0 0;
color: #000000;
}
.service-card {
display: flex;
gap: 50px 20px;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.card {
z-index: 1;
position: relative;
box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;
display: flex;
flex-direction: column;
align-items: center;
flex: 0 1 300px;
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
-o-border-radius: 10px;
}
.brand-icon {
margin-top: -40px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 80px;
height: 80px;
background-color: #00c9a7;
border: 1px solid #00c9a7;
border-radius: 50%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
}
.brand-icon i {
font-size: 40px;
color: #ffffff;
}
.card-body {
padding: 40px 20px 20px 20px;
text-align: center;
}
.card-body h3 {
text-transform: uppercase;
font-size: calc(1rem + .2vw);
font-weight: 700;
letter-spacing: 0.5px;
margin: 0 0 20px 0;
}
.card-body p {
color: #6a6a74;
margin: 0 0 25px 0;
font-size: 16px;
}
.card-btn {
padding: 15px 25px;
cursor: pointer;
text-transform: uppercase;
font-weight: 14px;
color: #f3f3f3;
background-color: #00c9a7;
border: 1px solid #00c9a7;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
}
/* card::after hover effect to change bg color */
.card::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #00c9a7;
z-index: -1;
border-radius: 10px;
transform: scaleY(0);
-webkit-transform: scaleY(0);
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-o-transform: scaleY(0);
transform-origin: top;
transition: transform 200ms ease-in-out;
-webkit-transition: transform 200ms ease-in-out;
-moz-transition: transform 200ms ease-in-out;
-ms-transition: transform 200ms ease-in-out;
-o-transition: transform 200ms ease-in-out;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
-o-border-radius: 10px;
}
.card:hover::after {
transform: scaleY(1);
-webkit-transform: scaleY(1);
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-o-transform: scaleY(1);
transform-origin: bottom;
}
.card:hover .card-body p {
color: #ffffff;
}
.card:hover .card-btn {
border: 1px solid #000000;
background-color: #000000;
}
Code & Preview
See the Pen responsive card hover effect by Mamun Hossain (@Mamun-Hossain-the-bold) on CodePen.
You can download the source code files for free by clicking the Source Code button. Additionally, you can edit and view a live demo by clicking the Code & Preview button below.