Skip to content

Commit f9858d7

Browse files
committed
CSS Heart
1 parent 1e4a56d commit f9858d7

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

12. Heart Shape/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8" />
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Pure CSS Heart Shape</title>
7+
<link rel="stylesheet" href="style.css" />
8+
</head>
9+
<body>
10+
<div class="heart"></div>
11+
</body>
12+
</html>

12. Heart Shape/style.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}
6+
7+
body {
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
height: 100vh;
12+
}
13+
14+
.heart {
15+
position: relative;
16+
width: 300px;
17+
height: 300px;
18+
background: #f00;
19+
transform: rotate(-45deg) scale(0.7);
20+
animation: changeColor 5s linear infinite;
21+
}
22+
23+
.heart::before {
24+
content: "";
25+
position: absolute;
26+
top: -50%;
27+
width: 100%;
28+
height: 100%;
29+
background: inherit;
30+
border-radius: 50%;
31+
}
32+
33+
.heart::after {
34+
content: "";
35+
position: absolute;
36+
top: 0%;
37+
left: 50%;
38+
width: 100%;
39+
height: 100%;
40+
background: inherit;
41+
border-radius: 50%;
42+
}
43+
44+
@keyframes changeColor {
45+
0% {
46+
filter: hue-rotate(0deg);
47+
}
48+
100% {
49+
filter: hue-rotate(360deg);
50+
}
51+
}

0 commit comments

Comments
 (0)