How to make this heart icon

I have made heart icon using 2 circles and one div angled. But i cant make it just show border of heart shape and make inside of heart transparent. I want heart like this where it just shows outline of heart and inside it must be transparent. When click on it , it should turn red. Any kind of help i will be very thankful❤️.
No description
14 Replies
vince
vince14mo ago
Use an svg
Choo♚𝕂𝕚𝕟𝕘
If you are able to make one solid heart, then you can make the outline by stack one smaller heart on top of a larger one.
C_7
C_714mo ago
'Font icons' || 'canvas'
Rägnar O'ock
Rägnar O'ock14mo ago
Icon fonts are not great as you for the user to download a (usually rather heavy) font for only a few icons. The trade off can be ok if you usea lot of icons, but most likely you won't. Canvas should not be used for that. Both are bad for accessibility. So as Vince said, svg is the way. You could use a png or a jpeg too, but the last two would be heavier that an svg and would not scale up as well if you needed them to.
MarkBoots
MarkBoots14mo ago
svg's indeed are the better solution But as a little fun exercise for my self, I did it with a single div. with borders and clippath https://codepen.io/MarkBoots/pen/vYvPOpZ
Jus Sus || 💀
Jus Sus || 💀OP14mo ago
@MarkBoots Achieved this using svg. but am actually impressed by this solution you provided. Thanks!
Chris Bolson
Chris Bolson14mo ago
I didn't want to be left out so have also created an alternative CSS only method in a slightly different way https://codepen.io/cbolson/pen/wvROMzG Whilst simple enough, it is not really practical as it has too many magic numbers.
MarkBoots
MarkBoots14mo ago
yea about the same idea. i did needed the clip to get rid of the overlapping border incase of no bg
ἔρως
ἔρως14mo ago
icons.getbootstrap.com has a full and an empty heart that you can use freely without having to add any license information (if you dont use a "substantial" set of the icons) dont re-invent the wheel with css and stuff, if there is a much more robust solution it has a filled and an empty heart if you need to fill it on hover or something, that isnt hard
Zoë
Zoë14mo ago
Also because there is a gradient behind make the smaller heart black and then use mix-blend-mode: lighten on the hearts so that the lighter background shows through
Chris Bolson
Chris Bolson14mo ago
I missed the bit about being transparent 🤦‍♂️ ... I have done another one with a slightly different approach. This version also fixes the need for magic-numbers https://codepen.io/cbolson/pen/wvROMdz
MarkBoots
MarkBoots14mo ago
nice, was thinking about that way too.
ἔρως
ἔρως14mo ago
that has some gaps:
No description
ἔρως
ἔρως14mo ago
if you really want to use css, why not a clip-path? it is percent based, so, should look good no matter the size
Want results from more Discord servers?
Add your server