Created
September 14, 2021 14:28
-
-
Save gmcusaro/355c4d707dd9ad7eebf17d693bca9573 to your computer and use it in GitHub Desktop.
Heart CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--heart-size: 100px; | |
} | |
* { | |
padding: 0; | |
margin: 0; | |
box-sizing: border-box; | |
} | |
.heart{ | |
height: var(--heart-size); | |
width: var(--heart-size); | |
background-color: #ff0000; | |
transform: rotate(45deg); | |
position: relative; | |
left: calc(var(--heart-size) / 2); | |
top: calc(var(--heart-size) / 2); | |
} | |
.heart::before, .heart::after { | |
content: ''; | |
background-color: inherit; | |
height: inherit; | |
width: inherit; | |
display: block; | |
position: absolute; | |
border-radius: 50px; | |
} | |
.heart::before { | |
bottom: calc(var(--heart-size) / 2); | |
} | |
.heart::after { | |
right: calc(var(--heart-size) / 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment