2014-11-24 52 views
0

我設計了一封電子郵件,使用來自github的模板。它在除www.outlook.com和outlook 2013之外的每個電子郵件客戶端都能正常工作。我正在使用名爲Confirmit的市場調查計劃發送我的電子郵件。如何在outlook中更改我的css按鈕的大小?

我想給我的按鈕一個靜態的寬度,因爲它在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%; \t 
 
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:[email protected]">[email protected]</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>

回答

1

你應該在HTML電子郵件中使用內聯樣式,因爲您的樣式標記將被谷歌郵件刪除(https://www.campaignmonitor.com/css/ - 這對於查看哪些樣式適用於哪些電子郵件客戶端也非常有用)

如果你想給你的按鈕一個靜態的大小,然後使用寬度/高度,而不是最大寬度/最大高度,因爲它們不支持在Outlook 07+

要整理內容表中居中您需要把它在一個表是100%寬度,然後將其設置爲align =「center」 What's the best way to center your HTML email content in the browser window (or email client preview pane)?

+0

因此,我基本上可以刪除所有的CSS,並只使用內聯的CSS? – Justin 2014-11-24 14:42:02

+0

是的,這是編碼HTML電子郵件的最佳做法 – Tim 2014-11-24 14:42:54