Wed May 04 2022
Card Design with clip-path
CSS5178 views
File Name: simple-card-design-in-html-css.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Card Design and Clip Path</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Radio+Canada:wght@400;500&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
font-family: 'Radio Canada', sans-serif;
}
body {
background-color: #383838;
}
section {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
aside.card {
background-color: #fafafa;
width: 280px;
height: 350px;
padding: 20px;
border-radius: 5px;
overflow: hidden;
position: relative;
display: flex;
justify-content: center;
align-items: flex-start;
flex-flow: column;
}
aside.card h1 {
font-size: 24px;
font-weight: 500;
color: #101010;
}
aside.card p {
font-size: 18px;
color: #383838;
}
aside.card .clip{
position: absolute;
background-color: #ff0c9a;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
flex-flow: column;
clip-path: circle(15% at 105% 47.5%);
transition: 0.5s all ease-in-out;
}
aside.card .clip h2 {
color: #fafafa;
font-size: 22px;
font-weight: 500;
}
aside.card .clip p {
color: #f1f1f1;
font-size: 18px;
font-weight: 400;
}
aside.card .clip .arrow {
position: absolute;
right: 2px;
top: calc(50% - 20px);
visibility: visible;
opacity: 1;
transition: 0.2s all ease-in-out;
}
aside.card .clip .arrow svg {
width: 20px;
height: 20px;
}
aside.card:hover .clip{
clip-path: circle(150% at 105% 47.5%);
}
aside.card:hover .clip .arrow {
visibility: hidden;
opacity: 0;
}
</style>
</head>
<body>
<section>
<aside class="card">
<h1>Hi Geek!</h1>
<p>You are at Geekboots</p>
<div class="clip">
<h2>Thanks for Watching!</h2>
<p>Keep in touch</p>
<a href="" class="arrow">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" stroke="#f2f2f2" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M14 5l7 7m0 0l-7 7m7-7H3" /></svg>
</a>
</div>
</aside>
</section>
</body>
</html>
Result Screenshot(s)
Author:Geekboots