cid1010 HTML CSS JQuery 名片设计-【网页前端设计】

index.html

  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <link rel="stylesheet" href="style.css">
  7. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
  8. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
  9. </head>
  10. <body>
  11. <div class="business-card middle">
  12. <div class="front">
  13. <h2>Shuichi Akai</h2>
  14. <span>Web Designer</span>
  15. <ul class="contact-info">
  16. <li>
  17. <i class="fas fa-mobile-alt"></i> +0000000000
  18. </li>
  19. <li>
  20. <i class="far fa-envelope"></i> akaishu@email.com
  21. </li>
  22. <li>
  23. <i class="fas fa-map-marker-alt"></i> Tokyo, Japan
  24. </li>
  25. </ul>
  26. </div>
  27. <div class="back">
  28. <span>DarkCode</span>
  29. </div>
  30. </div>
  31. <script>
  32. $(".business-card").click(function(){
  33. $(".business-card").toggleClass("business-card-active");
  34. });
  35. </script>
  36. </body>
  37. </html>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>

  </head>
  <body>

    <div class="business-card middle">
      <div class="front">
        <h2>Shuichi Akai</h2>
        <span>Web Designer</span>
        <ul class="contact-info">
          <li>
            <i class="fas fa-mobile-alt"></i> +0000000000
          </li>
          <li>
            <i class="far fa-envelope"></i> akaishu@email.com
          </li>
          <li>
            <i class="fas fa-map-marker-alt"></i> Tokyo, Japan
          </li>
        </ul>
      </div>
      <div class="back">
        <span>DarkCode</span>
      </div>
    </div>

    <script>
      $(".business-card").click(function(){
        $(".business-card").toggleClass("business-card-active");
      });
    </script>
  </body>
</html>

?style.css

  1. *{
  2. margin: 0;
  3. padding: 0;
  4. font-family: "montserrat",sans-serif;
  5. box-sizing: border-box;
  6. list-style: none;
  7. }
  8. body{
  9. background: url(bg.jpg) no-repeat;
  10. background-size: cover;
  11. }
  12. .business-card{
  13. width: 500px;
  14. height: 280px;
  15. }
  16. .middle{
  17. position: absolute;
  18. top: 50%;
  19. left: 50%;
  20. transform: translate(-50%,-50%);
  21. }
  22. .front,.back{
  23. width: 100%;
  24. height: 100%;
  25. overflow: hidden;
  26. position: absolute;
  27. backface-visibility: hidden;
  28. transition: transform 0.5s linear;
  29. }
  30. .front{
  31. background: rgba(255,255,255,.7);
  32. padding: 40px;
  33. transform: perspective(600px) rotateX(180deg);
  34. }
  35. .front::before,.front::after{
  36. content: "";
  37. position: absolute;
  38. right: 0;
  39. }
  40. .front::before{
  41. background: #2c3e50;
  42. width: 80px;
  43. height: 120px;
  44. bottom: 0;
  45. clip-path:polygon(0 100%,40% 0,100% 100%);
  46. }
  47. .front::after{
  48. background: #34495e;
  49. width: 100px;
  50. height: 100%;
  51. top: 0;
  52. clip-path:polygon(0 0,100% 0,100% 100%,80% 100%);
  53. }
  54. .front h2{
  55. text-transform: uppercase;
  56. }
  57. .front span{
  58. background: #34495e;
  59. color: #fff;
  60. padding: 4px 10px;
  61. display: inline-block;
  62. margin-bottom: 20px;
  63. font-size: 14px;
  64. }
  65. .front .contact-info li{
  66. margin: 10px 0;
  67. display: flex;
  68. align-items: center;
  69. }
  70. .front .contact-info li i{
  71. width: 26px;
  72. height: 26px;
  73. background: #34495e;
  74. color: #fff;
  75. display: flex;
  76. justify-content: center;
  77. align-items: center;
  78. margin-right: 6px;
  79. }
  80. .back{
  81. background: rgba(0,0,0,.7);
  82. display: flex;
  83. align-items: center;
  84. justify-content: center;
  85. color: #fff;
  86. text-transform: uppercase;
  87. letter-spacing: 8px;
  88. font-size: 24px;
  89. transform: perspective(600px) rotateX(0deg);
  90. }
  91. .business-card-active .front{
  92. transform: perspective(600px) rotateX(0deg);
  93. }
  94. .business-card-active .back{
  95. transform: perspective(600px) rotateX(-180deg);
  96. }
*{
  margin: 0;
  padding: 0;
  font-family: "montserrat",sans-serif;
  box-sizing: border-box;
  list-style: none;
}

body{
  background: url(bg.jpg) no-repeat;
  background-size: cover;
}

.business-card{
  width: 500px;
  height: 280px;
}

.middle{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.front,.back{
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: absolute;
  backface-visibility: hidden;
  transition: transform 0.5s linear;
}

.front{
  background: rgba(255,255,255,.7);
  padding: 40px;
  transform: perspective(600px) rotateX(180deg);
}

.front::before,.front::after{
  content: "";
  position: absolute;
  right: 0;
}

.front::before{
  background: #2c3e50;
  width: 80px;
  height: 120px;
  bottom: 0;
  clip-path:polygon(0 100%,40% 0,100% 100%);
}

.front::after{
  background: #34495e;
  width: 100px;
  height: 100%;
  top: 0;
  clip-path:polygon(0 0,100% 0,100% 100%,80% 100%);
}

.front h2{
  text-transform: uppercase;
}

.front span{
  background: #34495e;
  color: #fff;
  padding: 4px 10px;
  display: inline-block;
  margin-bottom: 20px;
  font-size: 14px;
}

.front .contact-info li{
  margin: 10px 0;
  display: flex;
  align-items: center;
}

.front .contact-info li i{
  width: 26px;
  height: 26px;
  background: #34495e;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 6px;
}

.back{
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 8px;
  font-size: 24px;
  transform: perspective(600px) rotateX(0deg);
}

.business-card-active .front{
  transform: perspective(600px) rotateX(0deg);
}
.business-card-active .back{
  transform: perspective(600px) rotateX(-180deg);
}

 

 


让链接同时具备两种打开方式

获取源码: Business Card
下载数:158人次, 文件大小: 0, 上传日期: 2020年-4 月-20日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

2,633 人查阅

类似文章