html - 如何在 outlook 中更改我的 css 按钮的大小?

标签 html css email outlook

我使用来自 github 的模板设计了一封电子邮件。它在除 www.outlook.com 和 outlook 2013 之外的每个电子邮件客户端中都运行良好。我正在使用名为 Confirmit 的市场研究程序来发送我的电子邮件。

我试图给我的按钮一个静态宽度,因为它在 outlook 2013 中看起来真的很奇怪。另外,我试图不让我的电子邮件在 outlook.com 中向左对齐,而是让它像在我的其他按钮上一样居中设备(iPad、Mac、手机)。有什么建议吗?

注意:^Aanhef^ 和 ^slink^ 是变量。 我有 ^slink^,代表调查链接,设置为:<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>

最佳答案

您应该在 HTML 电子邮件中使用内联样式,因为您的样式标签将被谷歌邮件删除(https://www.campaignmonitor.com/css/ - 这对于查看哪些样式适用于哪些电子邮件客户端也非常有用)

如果你想给你的按钮一个静态大小,那么使用宽度/高度而不是最大宽度/最大高度,因为它们在 Outlook 07+ 中不受支持

要整理居中的内容表格,您需要将其放在宽度为 100% 的表格中,然后将其设置为 align="centre" What's the best way to center your HTML email content in the browser window (or email client preview pane)?

关于html - 如何在 outlook 中更改我的 css 按钮的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27105026/

相关文章:

javascript - jQuery 插件和 ASP.NET 内容页面的问题

html - 在 HTML + CSS3 上将表单居中对齐

Python 我如何在电子邮件中发送多个文件。我可以发送 1 个文件,但如何发送超过 1 个

IOS 获取 exchange 2003 的日历事件和电子邮件

html - 使用 NodeJS 和 ExpressJS 托管静态渐进式 Web 应用程序 (PWA)

javascript - 多个 webRTC 连接

javascript - 如何验证 ionic 单选按钮

javascript - 如何在模态中设置条件

html - 我怎样才能在一个容器中底部对齐多个内联 block div 而不会丢失它们的流量?

python - 解析名称和电子邮件的小字符串?