css實現心形圖案


用1個標簽實現心形圖案,show you the code;

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
  <style type="text/css">
  .container{
    margin-top: 50px;
    text-align: center;
  }
   :root {
    --heart-color:pink;
  }
  .heart{
    display: inline-block;
    position: relative;
    width: 60px;
    height: 60px;
    background-color: var(--heart-color,red);
    transform: rotate(-45deg)
  }
  .heart::before,
  .heart::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--heart-color,red);;
  }
  .heart::before{
    top: -50%;
    left: 0;
  }
  </style>
</head>
<body>
  <div class="container">
    <i class="heart"></i>
  </div>
</body>
</html>

有木有覺得css很好玩,let's do something interesting!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM