How can I remove all white space surrounding HTML email?

后端 未结 2 1276
慢半拍i
慢半拍i 2020-12-22 03:36

I\'ve got the following html and css to be used as a template for generating e-mail messages.

But when it comes to receiving the e-mail on my postal programme I have

2条回答
  •  太阳男子
    2020-12-22 04:05

    Different e-mail clients render HTML e-mails differently. But there are a few basic practices you should adhere to (see references below).

    In looking at your code, there's a good chance your problem stems from the use of embedded styles. Here's what MailChimp has to say about that:

    Because browser-based email applications, such as Gmail, strip out and tags by default, always use inline CSS over embedded CSS.

    So, the padding: 0 and margin: 0 in your head section are possibly being ignored or overridden.

    Designing HTML e-mails is not like designing HTML websites. There's a huge technology gap between e-mail clients and web browsers. It's as if browsers keep evolving, but e-mail clients are stuck in 1998.

    In the world of HTML e-mail, embedded and external styles are bad, inline styles are good, javascript is bad, tables for layout are good. In this world, old-school coding methods are alive and well.

    More information:

    • CSS in HTML Email
    • Best practices for styling HTML emails
    • Best Practices & Considerations when writing HTML Emails

提交回复
热议问题