这是最后的样子 ,用一个div,再用before和after就行了
这是html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/ax.css"/>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="ax">
</div>
</body>
</html>
再加上css
*{
padding: 0px;
margin: 0px auto;
}
.ax{
width: 200px;
height: 200px;
background-color: red;
content: "";
margin: 200px auto;
transform: rotate(45deg);
position: relative;
}
.ax:before{
width: 200px;
height: 200px;
background-color: red;
content: "";
border-radius: 50%;
position: absolute;
right: 100px;
box-shadow: 100px -100px 0 red;
}
/*.ax:after{
width: 200px;
height: 200px;
background-color: red;
content: "";
border-radius: 50%;
position: absolute;
top: -100px;
}*/
上面是爱心的
在css3中,加入了很多新的东西,我们完全可以让它动起来
这是动的代码
@keyframes bb{
from{
transform:rotate(45deg) scale(1);
}
to{
transform:rotate(45deg) scale(2);
}
}
animation: bb 300ms linear alternate infinite;
这样就是一个会动的爱心了