gmail html preview removes css rule with page-break property

假如想象 提交于 2021-02-09 00:28:41

问题


we are sending html page as attachment to our users which they can use to print. When you view the html page using gmail in browser it removes any css rule with page-break-after property.

We want to force page-break for printing.

What is the work around for this.


回答1:


Nothing you can do about it. As explained by chipcullen Gmail strips out all CSS in webpage except the one inside the HTML tags, and even with those it does strange stuff like removing the page-break-after attributes.

The only workaround I can think about is to keep the html file or your server and simply send a link to it in your mail message in place of the attachement.

Great is the mistery surrounding these type of decisions made by Google engineers. Maybe they want users to go back using Outlook. Well, they almost convinced me.




回答2:


I can't say about the page-break-after property specifically, but I do know that Gmail does WEIRD things to CSS in HTML emails. For instance, Gmail will strip out any CSS that is either in the <head> or inline with the <body> tag. You will have to apply your rule inline.

From what it sounds like, you're relying more on the browser to render the attachment, and the user is printing from there. Are you sure page-break-after is supported in your test browser?



来源:https://stackoverflow.com/questions/10089768/gmail-html-preview-removes-css-rule-with-page-break-property

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