当前位置:   article > 正文

html实现邮件模版布局-flex布局&table布局-demo_邮件二维表格html模板

邮件二维表格html模板

邮件模版布局

flex - 布局简单方便  兼容性差

table - 优点 就是兼容性好,其他没有优点

注:使用图片需要png最好,使用svg图google邮箱会出现不能使用的情况

效果图

flex布局

  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>邮箱验证码</title>
  7. <style>
  8. * {
  9. padding: 0;
  10. margin: 0;
  11. }
  12. body {
  13. background-color: #f5f5f5;
  14. }
  15. .wrap {
  16. width: 610px;
  17. margin: 0 auto;
  18. background-color: #fff;
  19. border-radius: 10px;
  20. }
  21. .head-top > img {
  22. width: 100%;
  23. margin-bottom: 24px;
  24. }
  25. .head {
  26. display: flex;
  27. justify-content: space-between;
  28. padding: 0 30px;
  29. }
  30. .head-left-title > h1 {
  31. color: #000;
  32. font-family: PingFang SC;
  33. font-size: 18px;
  34. font-weight: 600;
  35. padding: 50px 0 20px;
  36. }
  37. .head-left-title > h3 {
  38. color: #000;
  39. font-family: PingFang SC;
  40. font-size: 14px;
  41. font-weight: 500;
  42. }
  43. .code {
  44. padding: 0 30px 75px;
  45. }
  46. .code > h2 {
  47. color: #000;
  48. font-family: PingFang SC;
  49. font-size: 14px;
  50. font-weight: 500;
  51. margin-bottom: 10px;
  52. }
  53. .code > .code-num {
  54. width: 100%;
  55. height: 64px;
  56. background-color: #E0FAFE;
  57. display: flex;
  58. justify-content: center;
  59. align-items: center;
  60. }
  61. .code-num > span {
  62. color: #000;
  63. font-family: PingFang SC;
  64. font-size: 32px;
  65. font-weight: 600;
  66. letter-spacing: 12.8px;
  67. }
  68. .code > h4 {
  69. color: #000;
  70. font-family: PingFang SC;
  71. font-size: 14px;
  72. font-weight: 400;
  73. margin-top: 10px;
  74. }
  75. .footer-wrap {
  76. display: flex;
  77. flex-direction: column;
  78. align-items: center;
  79. padding-bottom: 40px;
  80. }
  81. .footer-wrap > h2 {
  82. color: #000;
  83. font-family: PingFang SC;
  84. font-size: 12px;
  85. font-weight: 400;
  86. padding-bottom: 5px;
  87. }
  88. .footer-wrap > h3 {
  89. color: #6C6C6C;
  90. font-family: PingFang SC;
  91. font-size: 12px;
  92. font-weight: 400;
  93. padding-top: 5px;
  94. }
  95. .footer-wrap > h3::before {
  96. display: inline-block;
  97. vertical-align: middle;
  98. content: '';
  99. width: 3px;
  100. height: 3px;
  101. border-radius: 50%;
  102. margin-right: 5px;
  103. background-color: #6C6C6C;
  104. }
  105. .footer-connect {
  106. display: flex;
  107. flex-direction: column;
  108. align-items: center;
  109. }
  110. .footer-connect > h2 {
  111. color: #000;
  112. font-family: PingFang SC;
  113. font-size: 12px;
  114. font-weight: 400;
  115. padding-bottom: 10px;
  116. }
  117. .footer-connect > h3 {
  118. color: #6C6C6C;
  119. font-family: PingFang SC;
  120. font-size: 12px;
  121. font-weight: 400;
  122. padding-bottom: 32px;
  123. }
  124. .footer-img {
  125. padding-bottom: 47px;
  126. }
  127. .footer-img > img {
  128. width: 30px;
  129. height: 30px;
  130. margin: 0 22px;
  131. }
  132. </style>
  133. </head>
  134. <body>
  135. <div class="wrap">
  136. <div class="head-top">
  137. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/head-top.svg">
  138. </div>
  139. <div class="head">
  140. <div class="head-left">
  141. <img src="images/logo.svg">
  142. <div class="head-left-title">
  143. <h1 th:text="${$1}">Subject</h1>
  144. <h3 th:if="${not #strings.isEmpty($2)}" th:text="${$2}">Describe</h3>
  145. </div>
  146. </div>
  147. <div class="head-right">
  148. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/sketch.svg">
  149. </div>
  150. </div>
  151. <div class="code">
  152. <h2>验证码:</h2>
  153. <div class="code-num">
  154. <span th:text="${$3}">123456</span>
  155. </div>
  156. <h4 th:text="'验证码 ' + ${$4} + ' 分钟内有效,请勿泄露本邮件'">验证码 {} 分钟内有效,请勿泄露本邮件</h4>
  157. <h4 th:if="${not #strings.isEmpty($5)}" th:text="'防钓鱼码: ' + ${$5}">防钓鱼码: {}</h4>
  158. </div>
  159. <div class="footer">
  160. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/bg.svg">
  161. <div class="footer-wrap">
  162. <h2>致力于保护您的账户和交易安全</h2>
  163. <h3>如果您怀疑自己收到了诈骗信息,请立即联系客服</h3>
  164. <h3>如果您对邮件的真实性存有疑问,请勿犹豫,立即通过官方客服来核实信息</h3>
  165. <h3>请勿与任何人分享您的验证码,包括官方客服和工作人员</h3>
  166. </div>
  167. <div class="footer-connect">
  168. <h2>感谢您使用!</h2>
  169. <h3>如有疑问或需要帮助,请联系客服</h3>
  170. <div class="footer-img">
  171. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/t.svg">
  172. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/x.svg">
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </body>
  178. </html>

table布局-表格布局(推荐-兼容性高)

  1. <html>
  2. <head>
  3. <title>邮件模版</title>
  4. </head>
  5. <body>
  6. <!-- border="1" -->
  7. <table width="610" cellspacing="0" cellpadding="0"
  8. style="border-spacing: 0; color: #333333; margin-left: auto; margin-right: auto;border-radius: 10px;">
  9. <tr>
  10. <td colspan="2" width="610" height="10">
  11. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/head-top.svg" width="610px">
  12. </td>
  13. </tr>
  14. <tr>
  15. <td style="padding: 30px 0 0 30px;">
  16. <img src="images/logo.svg" width="154px">
  17. </td>
  18. <td rowspan="3" style="text-align: right;padding-top: 30px;">
  19. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/sketch.svg" width="188px">
  20. </td>
  21. </tr>
  22. <tr>
  23. <td>
  24. <h1 style="font-size: 18px;
  25. font-weight: 600;color: #000;padding: 50px 0 20px;padding-left: 30px;" th:text="${$1}">Subject</h1>
  26. </td>
  27. </tr>
  28. <tr>
  29. <td>
  30. <h3 style="font-size: 14px;font-weight: 500;color: #000;padding-left: 30px;"
  31. th:if="${not #strings.isEmpty($2)}" th:text="${$2}">
  32. Describe</h3>
  33. </h3>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td>
  38. <h2 style="font-size: 14px;
  39. font-weight: 500;color: #000;padding-left: 30px;">验证码:</h2>
  40. </td>
  41. </tr>
  42. <tr>
  43. <td colspan="2" style="padding: 0 30px;">
  44. <div style="width: 100%;
  45. height: 64px;
  46. background-color: #E0FAFE;text-align: center;line-height: 64px;">
  47. <span style="font-size: 32px;
  48. font-weight: 600;
  49. letter-spacing: 12.8px;" th:text="${$3}">123456</span>
  50. </div>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td>
  55. <h4 style="font-size: 14px;
  56. font-weight: 400;color: #000;margin-top: 10px;padding-left: 30px;"
  57. th:text="'验证码 ' + ${$4} + ' 分钟内有效,请勿泄露本邮件'">验证码 {}
  58. 分钟内有效,请勿泄露本邮件</h4>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td>
  63. <h4 style="font-size: 14px;
  64. font-weight: 400;color: #000;margin-top: 10px;padding-left: 30px;" th:if="${not #strings.isEmpty($5)}"
  65. th:text="'防钓鱼码: ' + ${$5}">防钓鱼码: {}</h4>
  66. </td>
  67. </tr>
  68. <tr>
  69. <td colspan="2" width="610" height="110">
  70. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/bg.svg" width="610px">
  71. </td>
  72. </tr>
  73. <tr>
  74. <td colspan="2" style="text-align: center;">
  75. <div style="padding-bottom: 40px;">
  76. <h2 style="font-size: 12px;
  77. font-weight: 400;color: #000;">AnyView致力于保护您的账户和交易安全</h2>
  78. <h3 style="font-size: 12px;
  79. font-weight: 400;color: #6C6C6C;">• 如果您怀疑自己收到了诈骗信息,请立即联系客服</h3>
  80. <h3 style="font-size: 12px;
  81. font-weight: 400;color: #6C6C6C;">• 如果您对邮件的真实性存有疑问,请勿犹豫,立即通过官方客服来核实信息</h3>
  82. <h3 style="font-size: 12px;
  83. font-weight: 400;color: #6C6C6C;">• 请勿与任何人分享您的验证码,包括官方客服和工作人员</h3>
  84. </div>
  85. </td>
  86. </tr>
  87. <tr>
  88. <td colspan="2" style="text-align: center;">
  89. <div>
  90. <h2 style="font-size: 12px;
  91. font-weight: 400;color: #000;padding-bottom: 10px;">感谢您使用!</h2>
  92. <h3 style="font-size: 12px;
  93. font-weight: 400;color: #6C6C6C;padding-bottom: 32px;">如有疑问或需要帮助,请联系客服</h3>
  94. <div style="padding-bottom: 47px;">
  95. <img src="https://d2t9byo8r5tyol.cloudfront.net/images/t.svg" width="30px">
  96. <img style="margin-left: 22px;" src="https://d2t9byo8r5tyol.cloudfront.net/images/x.svg"
  97. width="30px">
  98. </div>
  99. </div>
  100. </td>
  101. </tr>
  102. </table>
  103. </body>
  104. </html>
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/686311
推荐阅读
相关标签
  

闽ICP备14008679号