网页的本质就是超级文本标记语言,通过结合使用其他的Web技术(如:脚本语言、公共网关接口、组件等),可以创造出功能强大的网页。因而,超级文本标记语言是万维网(Web)编程的基础,也就是说万维网是建立在超文本基础之上的。超级文本标记语言之所以称为超文本标记语言,是因为文本中包含了所谓“超级链接”点。
本章给大家带来如何用纯css画一个跳动心?(代码实例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
先给大家看效果图:

实现原理:
1.可以把这个心分为两部分,两个长方形 ;

分别设置 border-radius;

让两个图形重合后,分别设置transform: rotate(),设置的rotate()值要相反,一个正值,一个负值;

在设置其中一个的 left 值 就成了

为了看起来有立体感,可以设置左边的 box-shadow 阴影 ;
再配合@keyframes,transform属性,实现跳动效果。
代码实例:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>纯css画一下心</title>
<style>
body{
height: 100%;
margin: 0;
}
.demo{
width: 1px;
height: 1px;
margin: 300px auto;
position: relative;
animation: tiaodong .8s linear infinite;
}
.demo::before,.demo::after{
content: '';
position: absolute;
width: 80px;
height: 120px;
background-color: red;
border-radius: 50px 50px 0 0;
}
.demo::after{
left: 28px;
transform: rotate(45deg);
}
.demo::before{
transform: rotate(-45deg);
box-shadow: -5px -5px 10px grey;
}
@keyframes tiaodong{
0%{
transform: scale(1);
}
50%{
transform: scale(1.05);
}
100%{
transform: scale(1);
}
}
</style>
</head>
<body>
<div class="demo"></div>
</body>
</html>