Font-Size in HTML Email via Gmail

◇◆丶佛笑我妖孽 提交于 2021-02-10 03:06:36

问题


Has anyone ever experienced a problem that, when a font-size style is applied to an element, the Gmail client isn't consistent when rendering? Example, I set the font-size to 17px and everything renders as too big, and then I set it to 16px and it becomes radically smaller.

Any input would be appreciated.


回答1:


Use pt instead of px for font-sizes, seem to work for me.




回答2:


Looks like they are overriding font-sizes and ignoring !important for text tags (a, p, etc)

When I applied the font-size to a wrapping <td> it worked fine.




回答3:


Are you making e-mail templates?

Then you should use good-old-back-to-basics font tag:

<font size="2">text</font>



回答4:


I faced this same issue today. I didn't find an answer on this thread that helped me personally.

However, I resolved it by surrounding all the ill-behaved text paras with a span that had inline style like this

<span style="color:#613400;font-size:14px;font-weight:bold;font-family:Calibri,Helvetica, Arial, Sans-Serif;">TEXT</span>

I realised later that even when I give font-size:14px!important; font didn't stick to the visible 14px size (Browser's element inspector showed it was 14px!), and the reason was probably that font-family was set different for that ill-behaving text. When I added font-family selector to the span, things started working fine.

This same style when applied to or as a whole didn't work. What I found as a solution was that you should style all the text with span surrounding it.

Hope this helps someone who stumble on this thread!



来源:https://stackoverflow.com/questions/12325905/font-size-in-html-email-via-gmail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!