我一直在關注各種指南在線諸如運動監視器的那些建立一個HTML頁面用於查看電子郵件客戶端。對於那些不熟悉的人來說,這基本上意味着將頁面從HTML表格和內聯CSS中構建出來,以創建普通網頁的外觀和格式。這種不同的編碼行爲是由於大多數電子郵件客戶端限制大量CSS樣式規則。對於測試,我一直使用Email on Acid來預覽我的頁面如何在各種電子郵件客戶端上呈現。編碼HTML:字體大小在Apple Mail比微軟Outlook始終較大
我遇到的問題是在Microsoft Outlook的文本看起來比真正的字體大小(如在Chrome,Firefox或Safari瀏覽),並且在蘋果的郵件文本顯示比真正的字體大小小。由於我希望在兩個平臺上都能看到我的頁面,所以我需要找到解決此問題的補救措施。
Here是示出如何每個平臺進行比較的圖像。請注意Apple Mail上的文本如此之大,以至於打破了表格的高度。毫不奇怪,簡單地縮小Apple Mail的文本大小並不是一種選擇,因爲它會將Outlook中的文本縮小爲遺忘。
如果您熟悉編碼就可以知道,這是一個混亂的商業電子郵件,並要求你打破常識的做法了大量的編碼 - 包括可讀性。爲了幫助細讀源代碼,here是一張清晰標記每個表格開始和結束位置的圖像(在Chrome中查看)。在下面的源代碼中,所有名爲「row_xx.jpg」的圖片都只是構成電子郵件邊框的垂直灰色位。這些圖像中的一些還在裏面有一些空白區域,以便給出縮進的幻覺。
來源:
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="600" height="8">
<img style="display:block;border:none;" src='images/row_11.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="10">
<img style="display:block;border:none;" src='images/row_12a.jpg' />
</td>
<td width="554" height="10" style="font-family:Lucida Grande;font-size: 7px;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</td>
<td width="2" height="10">
<img style="display:block;border:none;" src='images/row_12c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_13a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_13c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_14a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_14c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="600" height="8">
<img style="display:block;border:none;" src='images/row_15.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="10">
<img style="display:block;border:none;" src='images/row_16a.jpg' />
</td>
<td width="554" height="10" style="font-family:Lucida Grande;font-size: 7px;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</td>
<td width="2" height="10">
<img style="display:block;border:none;" src='images/row_16c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="14">
<img style="display:block;border:none;" src='images/row_17a.jpg' />
</td>
<td width="554" height="14" style="font-family:Lucida Grande;font-size: 7px;">
uis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</td>
<td width="2" height="14">
<img style="display:block;border:none;" src='images/row_17c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="600" height="11">
<img style="display:block;border:none;" src='images/row_18.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="13">
<img style="display:block;border:none;" src='images/row_19a.jpg' />
</td>
<td width="554" height="13" style="font-family:Lucida Grande;font-size: 7px;">
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</td>
<td width="2" height="13">
<img style="display:block;border:none;" src='images/row_19c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_20a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
=Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_20c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="600" height="12">
<img style="display:block;border:none;" src='images/row_21.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_22a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_22c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_23a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
quos dolores et quas molestias excepturi sint occaecati cupiditate non provident,
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_23c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="11">
<img style="display:block;border:none;" src='images/row_24a.jpg' />
</td>
<td width="554" height="11" style="font-family:Lucida Grande;font-size: 7px;">
similique sunt in culpa qui officia deserunt mollitia animi,
</td>
<td width="2" height="11">
<img style="display:block;border:none;" src='images/row_24c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_25a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_25c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="44" height="12">
<img style="display:block;border:none;" src='images/row_26a.jpg' />
</td>
<td width="554" height="12" style="font-family:Lucida Grande;font-size: 7px;">
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
</td>
<td width="2" height="12">
<img style="display:block;border:none;" src='images/row_26c.jpg' />
</td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 border=0>
<tr width="600">
<td width="600" height="24">
<img style="display:block;border:none;" src='images/row_27.jpg' />
</td>
</tr>
</table>
這個屬性似乎並不影響渲染中的文本,由於約翰的解決方案的結果表明將-webkit-text-size-setting設置爲100%或不返回相同的結果。關於我的頭頂,我覺得這表明這個屬性只會影響移動設置中的文本,但我需要對屬性本身做更多的研究。 – user3494572
看起來我很快就說話了。當我使用這種樣式時,肯定會發生一些事情,我相信我錯過了它,因爲它仍然不完全符合Chrome中的文本大小;無論如何,它確實在Apple Mail中減少了相當大的字體。直到我開始搞亂其他想法並將其禁用時,我才意識到這一點。我目前的工作流程涉及渲染之間的長時間等待,雖然很容易看到結果與Chrome的風格不匹配,但如果它與舊渲染相比有顯着區別,它完全會超出我的頭腦。謝謝你的提示! – user3494572
@ user3494572 Webkit前綴只會影響Mac客戶端,因爲它們是使用Webkit引擎呈現電子郵件的那些客戶端。 Thunderbird使用的Gecko也可能觸發,因爲它是相似的。 – John