<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Coração</title>
</head>
<body>
<div class="coracao"></div>
</body>
</html>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
body
{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Lato', sans-serif;
background-color: #262626;
}
.coracao
{
position: relative;
width: 100px;
height: 100px;
background-color: rgb(247, 72, 72);
transform: rotate(45deg);
animation: batidao 1.4s linear infinite;
}
.coracao:before
{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgb(247, 72, 72);
transform: translateY(-50%);
border-radius: 50%;
}
.coracao:after
{
content:'' ;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgb(247, 72, 72);
transform: translateX(-50%);
border-radius: 50%;
}
@keyframes batidao
{
0% {transform: rotate(45deg) scale(1);}
25% {transform: rotate(45deg) scale(1);}
30% {transform: rotate(45deg) scale(1.4);}
50% {transform: rotate(45deg) scale(1.2);}
70% {transform: rotate(45deg) scale(1.4);}
100% {transform: rotate(45deg) scale(1);}
}
JS
格式化