我使用github中的模板设计了一封电子邮件。除了www.outlook.com和outlook 2013之外,它在每个电子邮件客户端都可以正常工作。我正在使用名为Confirmit的市场研究计划来发送我的电子邮件。
我试图给我的按钮一个静态宽度,因为它在outlook 2013中看起来很奇怪。而且,我试图不让我的电子邮件在outlook.com中左对齐,但让它像我在其他地方那样居中设备(iPad,Mac,手机)。有什么建议吗?
注意:^ Aanhef ^和^ slink ^是变量。
我有^ slink ^,代表surveylink,设置为:<p></p><div class="btn-first">Aliquam vel bebendum!<p></p>
这是电子邮件在Outlook 2013中的显示方式(按钮不是静态的,而是大的方式)。 http://i60.tinypic.com/wmbcax.png(我知道我没有足够的代表,但这会让你更容易帮助我!)
这是我的代码:
<style>
/* -------------------------------------
GLOBAL
------------------------------------- */
* {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
font-size: 100%;
line-height: 1.6;
}
img {
max-width: 100%;
}
body {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none;
width: 100%!important;
height: 100%;
}
/* -------------------------------------
ELEMENTS
------------------------------------- */
a {
color: #348eda;
}
.btn-first {
border: 1px solid rgb(30, 54, 80);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px; color: rgb(255, 255, 255);
display: inline-block;
font-family: sans-serif;
font-size: 13px;
font-weight: bold;
line-height: 40px;
line-width: 30%;
text-align: center;
text-decoration: none;
max-width: 300px;
max-height: 40px;
background-color: rgb(86, 12, 112);
}
.btn-primary {
text-decoration: none;
color: #FFF;
background-color: #3C175C;
border: solid #3C175C;
border-width: 10px 20px;
line-height: 2;
font-weight: bold;
margin-right: 10px;
text-align: center;
cursor: pointer;
display: inline-block;
border-radius: 25px;
}
.btn-secondary {
text-decoration: none;
color: #FFF;
background-color: #aaa;
border: solid #aaa;
border-width: 10px 20px;
line-height: 2;
font-weight: bold;
margin-right: 10px;
text-align: center;
cursor: pointer;
display: inline-block;
border-radius: 25px;
}
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.padding {
padding: 10px 0;
}
/* -------------------------------------
BODY
------------------------------------- */
table.body-wrap {
width: 100%;
padding: 20px;
}
table.body-wrap .container {
border: 2px solid #f0f0f0;
}
/* -------------------------------------
FOOTER
------------------------------------- */
table.footer-wrap {
width: 100%;
clear: both!important;
}
.footer-wrap .container p {
font-size: 12px;
color: #666;
}
table.footer-wrap a {
color: #999;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1, h2, h3 {
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
line-height: 1.1;
margin-bottom: 15px;
color: #3C175C;
margin: 40px 0 10px;
line-height: 1.2;
font-weight: 200;
}
h1 {
font-size: 36px;
}
h2 {
font-size: 28px;
}
h3 {
font-size: 22px;
}
p, ul, ol {
margin-bottom: 10px;
font-weight: normal;
font-size: 14px;
}
ul li, ol li {
margin-left: 5px;
list-style-position: inside;
}
/* ---------------------------------------------------
RESPONSIVENESS
Nuke it from orbit. It's the only way to be sure.
------------------------------------------------------ */
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display: block!important;
max-width: 300px!important;
margin: 0 auto!important; /* makes it centered */
clear: both!important;
}
/* Set the padding on the td rather than the div for Outlook compatibility */
.body-wrap .container {
padding: 20px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
max-width: 600px;
margin: 0 auto;
display: block;
}
/* Let's make sure tables in the content area are 100% wide */
.content table {
width: 100%;
}
</style>
<font face="calibri">
<table class="body-wrap">
<tbody><tr>
<td></td>
<td class="container" bgcolor="#ffffff">
<div class="content">
<table>
<tbody><tr>
<td><br/>
<center><img src="http://www.zbrastudios.com/wp-content/uploads/2013/02/Lorem-Ipsum_2-14-13.jpg"/></center>
<h1><b>Uitnodiging</b></h1><p></p>
<p>^Aanhef^,</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque in pellentesque augue
Sed vehicula scelerisque massa, a accumsan lectus laoreet eget. Praesent et ligula malesuada, elementum nisi ac, laoreet enim.</p>
<p>Donec feugiat nibh at tortor pellentesque iaculis. Vestibulum at eros egestas purus sagittis cursus posuere a nibh. Mauris eleifend dignissim ullamcorper</p>
<p>Curabitur venenatis ac lectus nec tincidunt. Pellentesque at sapien congue, blandit ipsum ut, euismod dolor. Morbi in tincidunt augue.</p>
<p>Duis dui sapien, volutpat at pulvinar ac, cursus ac metus. Cras gravida cursus mi sit amet imperdiet.</p>
<table>
<tbody>
<tr><td class="padding">
^SLINK^
</td></tr><tr>
</tr>
</tbody></table><br/>
<p>Donec vel porta eros. Nam viverra erat non lorem auctor,</p>
<p>Donec nec gravida ipsum.,
</p><p>Donec vel<br/>Nam viverra erat.</p>
<p><i>Aliquam vel bibendum elit. Morbi bibendum bibendum ex. Sed mollis, quam in pulvinar luctus, ipsum purus dignissim ante, at rutrum diam tortor sed libero. Donec nec gravida ipsum.
<a href="mailto:test@example.com">test@example.com</a>.</i></p>
</td>
</tr>
</tbody></table>
</div>
</td>
<td></td>
</tr>
</tbody></table>
<table class="footer-wrap">
<tbody><tr>
<td></td>
<td class="container">
<div class="content">
<table>
<tbody><tr>
<td align="center">
<p>Lorem ipsum sapien: <br/><a href="#">
<img src="http://www.zbrastudios.com/wp-content/uploads/2013/02/Lorem-Ipsum_2-14-13.jpg" alt="Customeyes" height="23" width="150"/></a>
</p><p></p>
</td>
</tr>
</tbody></table>
</div>
</td>
<td></td>
</tr>
</tbody></table>
</font>
&#13;
答案 0 :(得分:1)
您应该在HTML电子邮件中使用内联样式,因为您的样式标记将被google mail(https://www.campaignmonitor.com/css/删除 - 这对于查看哪些样式适用于哪些电子邮件客户端非常有用)
如果你想给你的按钮一个静态大小,那么使用宽度/高度而不是max-width / max-height,因为它们在Outlook 07 +中不受支持
要对要居中的内容表进行排序,您需要将其放在100%宽度的表中,然后将其设置为align =&#34; center&#34; What's the best way to center your HTML email content in the browser window (or email client preview pane)?