File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments