当前位置:   article > 正文

纯html+css实现的show花式爱心代码_用httml+css打爱心的代码

用httml+css打爱心的代码

纯html+css实现的,鼠标移动到爱心上会跳动。

 

  1. <style>
  2. .heart {
  3. position: relative;
  4. width: 100px;
  5. height: 90px;
  6. margin: 30px auto;
  7. }
  8. .heart:before,
  9. .heart:after {
  10. position: absolute;
  11. content: "";
  12. left: 50px;
  13. top: 0;
  14. width: 50px;
  15. height: 80px;
  16. background: red;
  17. border-radius: 50px 50px 0 0;
  18. transform: rotate(-45deg);
  19. transform-origin: 0 100%;
  20. }
  21. .heart:after {
  22. left: 0;
  23. transform: rotate(45deg);
  24. transform-origin: 100% 100%;
  25. }
  26. .heart:hover {
  27. animation: beat 0.5s infinite alternate;
  28. }
  29. @keyframes beat {
  30. from {
  31. transform: scale(1);
  32. }
  33. to {
  34. transform: scale(1.2);
  35. }
  36. }
  37. </style>
  38. <div class="heart"></div>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/603292
推荐阅读
相关标签
  

闽ICP备14008679号