0


CSS3绘制3D银行卡片层叠展示特效

使用纯css3绘制3D银行卡层叠展示特效

94c7a3c65c493e641d15eefddab7639e.gif

具体示例如下

  1. <template>
  2. <div>
  3. <div class="tariffCards">
  4. <div class="economy">
  5. <img src="../images/css-article-imgs/example-css3D-card/tarcs.png" alt="中信银行" height="74">
  6. <h3>中信银行</h3>
  7. <span>zhongxin bank</span>
  8. </div>
  9. <div class="premiumeconomy">
  10. <img src="../images/css-article-imgs/example-css3D-card/tarcs.png" alt="中国银行" height="74">
  11. <h3>中国银行</h3>
  12. <span>chinease bank</span>
  13. </div>
  14. <div class="business">
  15. <img src="../images/css-article-imgs/example-css3D-card/tarcs.png" alt="交通银行" height="74">
  16. <h3>交通银行</h3>
  17. <span>jiaotong bank</span>
  18. </div>
  19. <div class="first">
  20. <img src="../images/css-article-imgs/example-css3D-card/tarcs.png" alt="江苏银行" height="74">
  21. <h3>江苏银行</h3>
  22. <span>jiangsu bank</span>
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <style scoped>
  28. .tariffCards {
  29. position: absolute;
  30. top: 50%;
  31. left: 50%;
  32. margin: -180px 0 0 -140px;
  33. user-select: none;
  34. transform: translate3d(0, 0, 0);
  35. transform-style: preserve-3d;
  36. }
  37. .tariffCards:after {
  38. position: absolute;
  39. bottom: -27px;
  40. left: 5%;
  41. content: "";
  42. width: 65%;
  43. height: 10px;
  44. border-radius: 100%;
  45. background-image: radial-gradient(rgba(34, 50, 84, 0.04), rgba(34, 50, 84, 0));
  46. }
  47. .tariffCards > div {
  48. position: relative;
  49. width: 280px;
  50. height: 140px;
  51. border-radius: 12px;
  52. color: white;
  53. transform: rotateX(45deg) rotateY(-15deg) rotate(45deg);
  54. transition: all 0.4s ease;
  55. overflow: hidden;
  56. cursor: pointer;
  57. }
  58. .tariffCards > div:after {
  59. position: absolute;
  60. top: -70px;
  61. left: 0;
  62. content: "";
  63. width: 200%;
  64. height: 200%;
  65. background-image: linear-gradient(60deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 80%);
  66. transform: translateX(-100%);
  67. }
  68. .tariffCards > div img {
  69. margin-top: 15px;
  70. pointer-events: none;
  71. }
  72. .tariffCards > div h3 {
  73. position: absolute;
  74. bottom: 28px;
  75. left: 15px;
  76. font-size: 18px;
  77. font-weight: 800;
  78. }
  79. .tariffCards > div span {
  80. position: absolute;
  81. font-weight: 700;
  82. bottom: 15px;
  83. left: 15px;
  84. font-size: 12px;
  85. font-weight: 600;
  86. opacity: 0.8;
  87. }
  88. .tariffCards > div.economy {
  89. margin-top: 0;
  90. z-index: 3;
  91. background-color: #8063E1;
  92. background-image: linear-gradient(135deg, #BD7BE8, #8063E1);
  93. box-shadow: 20px 20px 60px rgba(34, 50, 84, 0.5), 1px 1px 0px 1px #8063E1;
  94. }
  95. .tariffCards > div.premiumeconomy {
  96. margin-top: -70px;
  97. z-index: 2;
  98. background-color: #3F58E3;
  99. background-image: linear-gradient(135deg, #7F94FC, #3F58E3);
  100. box-shadow: 20px 20px 60px rgba(34, 50, 84, 0.5), 1px 1px 0px 1px #3F58E3;
  101. }
  102. .tariffCards > div.business {
  103. margin-top: -70px;
  104. z-index: 1;
  105. background-color: #2C6FD1;
  106. background-image: linear-gradient(135deg, #21BBFE, #2C6FD1);
  107. box-shadow: 20px 20px 60px rgba(34, 50, 84, 0.5), 1px 1px 0px 1px #2C6FD1;
  108. }
  109. .tariffCards > div.first {
  110. margin-top: -70px;
  111. background-color: #352F64;
  112. background-image: linear-gradient(135deg, #415197, #352F64);
  113. box-shadow: 5px 5px 60px rgba(34, 50, 84, 0.1), 1px 1px 0px 1px #352F64;
  114. }
  115. .tariffCards > div:hover {
  116. transform: rotateX(30deg) rotateY(-15deg) rotate(30deg) translate(-25px, 50px);
  117. }
  118. .tariffCards > div:hover:after {
  119. transform: translateX(100%);
  120. transition: all 1.2s ease-in-out;
  121. }
  122. </style>

实现这个3D卡片,需要在最外层父级元素添加

  1. transform: translate3d(0, 0, 0);transform-style: preserve-3d

,声明

  1. 3D

,结合

  1. css3

  1. transform

的变换,平移就可以实现

村民私自搭桥收费被判刑

2023-07-10

聊一下大学几年如何渡过

2023-07-09

聊一聊抑郁症

2023-07-07

PHP中的变量

2023-07-04

了解PHP-入门-环境搭建-集成环境安装

2023-07-03

e5561038d4535acb9c63211b7792b1f2.png

b5186814ab4fc17735ba046d8a527e10.png

dfe2e8988577bb8b171051f13fca2099.png

标签: css3 3d css

本文转载自: https://blog.csdn.net/wzc_coder/article/details/131714509
版权归原作者 itclanCoder 所有, 如有侵权,请联系我们删除。

“CSS3绘制3D银行卡片层叠展示特效”的评论:

还没有评论