我在响应式电子邮件模板中产生一种效果时遇到问题。这是关于使用移动版本的“ dir”将最后两列的顺序从三列更改为三列。我是使用本教程https://codepen.io/roshodgekiss/pen/rJemj
完成的但这些列的相反作用正在改变顺序,但在台式机版本中。
我的代码:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv=" X-UA-Compatible" content="IE=edge">
<meta name="x-apple-disable-message-reformatting">
<title>Responsive Email Template</title>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:400,700&display=swap&subset=latin-ext" rel="stylesheet">
<!-- CSS Reset : BEGIN -->
<style>
html,
body {
margin: 0 auto !important;
padding: 0 !important;
height: 100% !important;
width: 100% !important;
background: #fff;
}
/* What it does: Stops email clients resizing small text. */
* {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
/* What it does: Centers email on Android 4.4 */
div[style*="margin: 16px 0"] {
margin: 0 !important;
}
/* What it does: Stops Outlook from adding extra spacing to tables. */
table,
td {
mso-table-lspace: 0pt !important;
mso-table-rspace: 0pt !important;
}
/* What it does: Fixes webkit padding issue. */
table {
border-spacing: 0 !important;
border-collapse: collapse !important;
table-layout: fixed !important;
margin: 0 auto !important;
}
/* What it does: Uses a better rendering method when resizing images in IE. */
img {
-ms-interpolation-mode: bicubic;
}
/* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */
a {
text-decoration: none;
}
/* What it does: A work-around for email clients meddling in triggered links. */
*[x-apple-data-detectors],
/* iOS */
.unstyle-auto-detected-links *,
.aBn {
border-bottom: 0 !important;
cursor: default !important;
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* What it does: Prevents Gmail from displaying a download button on large, non-linked images. */
.a6S {
display: none !important;
opacity: 0.01 !important;
}
/* What it does: Prevents Gmail from changing the text color in conversation threads. */
.im {
color: inherit !important;
}
/* If the above doesn't work, add a .g-img class to any image in question. */
img.g-img+div {
display: none !important;
}
/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */
/* Create one of these media queries for each additional viewport size you'd like to fix */
/* iPhone 4, 4S, 5, 5S, 5C, and 5SE */
@media only screen and (min-device-width: 320px) and (max-device-width: 374px) {
u~div .email-container {
min-width: 320px !important;
}
}
/* iPhone 6, 6S, 7, 8, and X */
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
u~div .email-container {
min-width: 375px !important;
}
}
/* iPhone 6+, 7+, and 8+ */
@media only screen and (min-device-width: 414px) {
u~div .email-container {
min-width: 414px !important;
}
}
</style>
<!-- CSS Reset : END -->
<!-- Style CSS : BEGIN -->
<style>
p {
margin: 0;
}
a {
color: #27416b;
}
a:hover {
color: #F98E2B;
}
ul {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
h2,
h3 {
margin: 0;
}
img {
border: 0;
}
/* --- Mobile Style : BEGIN --- */
@media screen and (max-width: 400px) {
.box {
width: 100% !important;
display: block !important;
}
.col-content--size {
width: 100% !important;
display: block;
}
.col-content {
padding-right: 0 !important;
padding-bottom: 14px !important;
}
}
@media screen and (min-width: 321px) and (max-width: 480px) {
.col-content--size {
width: 48% !important;
display: inline-block
}
.col-content {
padding-right: 0 !important;
}
.col-content.gap-1 {
padding-right: 12px !important;
}
.gap-3 {
display: block !important;
padding-top: 14px;
margin: 0 auto;
}
}
/* --- Mobile Style: END --- */
.col-content {
padding-right: 10px;
}
.col-headline h2 {
font-size: 34px;
padding-top: 25px;
padding-bottom: 18px;
}
.col-headline h3 {
font-size: 16px;
}
.btn-content {
padding-top: 38px;
padding-bottom: 7px;
display: inline-block;
}
.btn-content a {
display: block;
}
.btn {
padding: 8px 29px;
border-radius: 30px;
background-color: #00c39e;
color: #fff;
}
@media only screen and (max-width: 700px) {
.content {
width: 100% !important;
}
}
</style>
</head>
<body style="margin: 0; padding: 0; background-color: #fff; mso-line-height-rule: exactly; font-family: 'Josefin Sans', sans-serif; color: #27416b">
<!-- CONTAINER TABLE -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="table-layout: fixed">
<tr>
<td style="padding-top: 40px">
<table class="main content" border="0" cellpadding="0" cellsacing="0" style="width: 700px; margin: 0px auto;">
<tr>
<td style="padding: 0 5px">
<!-- MAIN -->
<table bgcolor="#f5f0e8" border="0" cellpadding="0" cellsacing="0" width="100%">
<tr>
<td style="padding: 14px;">
<table border="0" cellpadding="0" cellsacing="0" width="100%">
<tr>
<td class="box box-1" style="width: 33.33%" aling="center" valign="top">
<table border="0" cellpadding="0" cellsacing="0" width="100%">
<tr>
<td class="col-content col-content--size gap-1" aling="center" valign="top" style="width: 100%">
<table border="0" cellpadding="0" cellsacing="0" width="100%">
<tr>
<td class="col-headline" style="text-align: center; background-color: #fff; padding: 13px 5px 0;" valign="top" height="160">
<img src="https://source.unsplash.com/30x30" alt="report">
<h2>Report</h2>
<h3>ADVANCED DASHBORDS</h3>
</td>
</tr>
<tr>
<td style="background-color: #fff; text-align: center; padding: 0 5px" aling="center" valign="top" height="135">
<p>Analyze customer information to better know them and measure marketing strategies in real-time thanks to a large number of pre-calculated KPI</p>
</td>
</tr>
<tr>
<td align="center" style="text-align: center; background-color: #fff">
<span class="btn-content">
<a href="#" class="btn btn-primary">Check</a>
</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class="box box-2" aling "center" valign="top" style="width: 66.66%">
<table border="0" cellpadding="0" cellsacing="0" width="100%" dir="rtl">
<tr>
<td class="col-content col-content--size gap-2" aling="center" valign="top" style="width: 33.33%" dir="ltr">
<table border="0" cellpadding="0" cellsacing="0" width="100%">
<tr>
<td class="col-headline" style="text-align: center; background-color: #fff; padding: 13px 5px 0;" valign="top" height="160">
<img src="https://source.unsplash.com/30x30" alt="data">
<h2>Data</h2>
<h3>DATA CENTRALIZATION</h3>
</td>
</tr>
<tr>
<td style="background-color: #fff; text-align: center; padding: 0 5px" aling="center" valign="top" height="135">
<p>Store all the information about each customer during all the relationship in one place.</p>
</td>
</tr>
<tr>
<td align="center" style="text-align: center; background-color: #fff">
<span class="btn-content btn--gap">
<a href="#" class="btn btn-primary">Check</a>
</span>
</td>
</tr>
</table>
</td>
<td class="col-content--size gap-3" aling="center" valign="top" style="width: 33.33%" dir="ltr">
<table border="0" cellpadding="0" cellsacing="0" width="100%">
<tr>
<td class="col-headline" style="text-align: center; background-color: #fff; padding: 13px 5px 0;" valign="top" height="160">
<img src="https://source.unsplash.com/30x30" alt="target">
<h2>Target</h2>
<h3>ULTRA-PRECISE TARGETING</h3>
</td>
</tr>
<tr>
<td style="background-color: #fff; text-align: center; padding: 0 5px" aling="center" valign="top" height="135">
<p>Segment customers the intuitive way by addressing all business challenges related to targeting.</p>
</td>
</tr>
<tr>
<td align="center" style="text-align: center; background-color: #fff">
<span class="btn-content btn--gap">
<a href="#" class="btn btn-primary">Check</a>
</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr><!-- end tr -->
</table>
</td>
</tr><!-- end tr -->
</table>
</body>
</html>
谢谢您的帮助! 最好的问候