Css-heart
综合使用css3动画、渐变等手段实现
by Korah Babu Varghese
HTML
<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css">
<body>
<div class="sb-opener-container sb-pulsating">
<button class="sb-opener sb-bubble fa fa-heart sb-opener-show"></button>
</div>
</body>
CSS
.sb-pulsating {
-webkit-animation: sb-pulse 2s infinite;
-moz-animation: sb-pulse 2s infinite;
-o-animation: sb-pulse 2s infinite;
-ms-animation: sb-pulse 2s infinite;
animation: sb-pulse 2s infinite;
}
.sb-opener-container {
position: absolute;
left: 20px;
top: 20px;
-webkit-border-radius: 100px;
border-radius: 100px;
}
@-webkit-keyframes 'sb-pulse' {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(233, 44, 108, .5);
box-shadow: 0 0 0 0 rgba(233, 44, 108, .5);
}
70% {
-webkit-box-shadow: 0 0 0 15px rgba(233, 44, 108, 0);
box-shadow: 0 0 0 15px rgba(233, 44, 108, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(233, 44, 108, 0);
box-shadow: 0 0 0 0 rgba(233, 44, 108, 0);
}
}
.sb-bubble {
cursor: pointer;
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-webkit-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 2px 2px 20px #000;
box-shadow: 2px 2px 20px #000;
color: #fcfcfc;
}
.sb-bubble:before {
position: absolute;
top: 50%;
left: 0;
right: 0;
text-align: center;
}
.sb-opener {
border-style: solid;
border-color: rgba(0, 0, 0, .02);
background-color: #e92c6c;
background: -webkit-linear-gradient(top left, #e92c6c 0, #e81f63 100%);
background: -moz-linear-gradient(top left, #e92c6c 0, #e81f63 100%);
background: -o-linear-gradient(top left, #e92c6c 0, #e81f63 100%);
background: -ms-linear-gradient(top left, #e92c6c 0, #e81f63 100%);
background: linear-gradient(to bottom right, #e92c6c 0, #e81f63 100%);
text-shadow: 2px 2px #ea6c93;
-webkit-transform: rotateZ(45deg);
-moz-transform: rotateZ(45deg);
-o-transform: rotateZ(45deg);
-ms-transform: rotateZ(45deg);
transform: rotateZ(45deg);
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
.sb-opener {
width:...