<div class="heart"></div>That's all we need now.
.heart {
position: relative;
width: 100px;
height: 100px;
border: solid 1px red;
border-top: none;
border-left: none;
}
.heart: before, .heart: after {
position: absolute;
content: '';
-webkit-border-radius: 50px 0 0 50px; / * for Chrome and Safari * /
-moz-border-radius: 50px 0 0 50px; / * for Firefox * /
border-radius: 50px 0 0 50px;
width: 70px;
height: 100px;
border: solid 1px red;
border-right: none;
} .heart {
position: relative;
width: 100px;
height: 100px;
-webkit-transform: rotate (45deg); / * for Chrome and Safari * /
-moz-transform: rotate (45deg); / * for Firefox * /
-o-transform: rotate (45deg); / * for Opera * /
transform: rotate (45deg);
border: solid 1px red;
border-top: none;
border-left: none;
}
.heart: before, .heart: after {
position: absolute;
content: '';
-webkit-border-radius: 50px 0 0 50px;
-moz-border-radius: 50px 0 0 50px;
border-radius: 50px 0 0 50px;
width: 70px;
height: 100px;
border: solid 1px red;
border-right: none;
left: -70px;
}
.heart: after {
position: absolute;
left: 15px;
top: -85px;
-webkit-transform: rotate (90deg);
-moz-transform: rotate (90deg);
-o-transform: rotate (90deg);
} What we got is:
.heart {
background: red;
/ * for browsers that don't support gradient * /
background: -webkit-radial-gradient (115% 50%, 75px 110px, # 8B0000, # 8B0000, red);
/ * for Chrome and Safari * /
background: -moz-radial-gradient (170% 50%, circle, # 8B0000 0%, # 8B0000 52%, red 76%);
/ * for Firefox * /
background: -o-radial-gradient (115% 50%, 75px 110px, # 8B0000, # 8B0000, red);
/ * for Opera * /
background: radial-gradient (115% 50%, 75px 110px, # 8B0000, # 8B0000, red);
/ * according to CSS3 standards * /
} .heart: before {
background: red;
background: -webkit-radial-gradient (15% 50%, 65px 65px, # FFE4E1, red);
background: -moz-radial-gradient (15% 50%, circle, # FFE4E1, red 85%);
background: -o-radial-gradient (15% 50%, 65% 65%, # FFE4E1, red);
background: radial-gradient (15% 50%, 65% 65%, # FFE4E1, red);
} .heart: after {
background: red;
background: -webkit-radial-gradient (50% 80%, 85px 80px, # FFB6C1, red, # 8B0000);
background: -moz-radial-gradient (50% 80%, circle, # FFB6C1, red, # 8B0000 90%);
background: -o-radial-gradient (50% 80%, 85px 80px, # FFB6C1, red, # 8B0000);
background: radial-gradient (50% 80%, 85px 80px, # FFB6C1, red, # 8B0000);
} .heart {
animation-name: 'anime';
/ * animation keyframe name * /
animation-duration: 300ms;
/ * animation duration * /
animation-iteration-count: infinite;
/ * number of repetitions, in this case - infinite * /
animation-direction: alternate;
/ * play the animation in the forward and reverse order * /
animation-timing-function: ease-in;
/ * calculation of time intervals for animation, in this case animation accelerates * /
} @keyframes 'anime' {
from {
transform: scale (1) rotate (45deg);
}
to {
transform: scale (1.1) rotate (45deg);
}
}
.heart {
-webkit-animation-name: 'anime';
-webkit-animation-duration: 300ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-in;
} @ -webkit-keyframes 'anime' {
from {
-webkit-transform: scale (1) rotate (45deg);
}
to {
-webkit-transform: scale (1.1) rotate (45deg);
}
}
Source: https://habr.com/ru/post/137197/
All Articles