用html+css给女朋友写一个爱心

这是最后的样子 ,用一个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;

这样就是一个会动的爱心了

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值