欢迎光临散文网 会员登陆 & 注册

css实现 跳动的爱心 昨夜星光闪闪,爱你的心满满

2023-05-20 13:50 作者:木下歌  | 我要投稿

<!DOCTYPE html>

<html lang="en">


<head>

  <meta charset="UTF-8">

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Document</title>

</head>

<style>

  * {

    padding: 0px;

    margin: 0px;

  }


  body {

    width: 100vw;

    height: 100vh;

    display: flex;

    background-color: pink;

    justify-content: center;

    align-items: center;

  }


  .love {

    height: 200px;

    width: 200px;

    background-color: red;

    position: relative;

    transform: rotate(45deg) scale(0.85);

    animation: love 1s infinite;

  }


  .love:hover {

    animation: heat 0.4s infinite alternate;

  }


  .love::after {

    content: '';

    height: 200px;

    width: 200px;

    background-color: red;

    position: absolute;

    top: -100px;

    border-radius: 50%;

  }


  .love::before {

    content: '';

    height: 200px;

    width: 200px;

    background-color: red;

    position: absolute;

    left: -100px;

    border-radius: 50%;

  }


  @keyframes love {

    0% {

      transform: rotate(45deg) scale(0.85);

    }



    50% {

      transform: rotate(45deg) scale(1);

    }



    100% {

      transform: rotate(45deg) scale(1);

    }

  }


  @keyframes heat {

    0% {

      transform: rotate(45deg) scale3d(1, 1, 1);

    }


    50% {

      transform: rotate(45deg) scale3d(1.1, 1.1, 1.1);

    }


    100% {

      transform: rotate(45deg) scale3d(1, 1, 1);

    }

  }

</style>


<body>

  <div class="love">


  </div>

</body>


</html>

css实现 跳动的爱心 昨夜星光闪闪,爱你的心满满的评论 (共 条)

分享到微博请遵守国家法律