Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

css - How to style emails?

Do I need to use style attribute everywhere, which leads to lots of duplication?

<p style="color: red; font-weight: bold;">Some text</p>

Use of <style> seems to fail

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Many email clients will strip out CSS and classes, and one of the ways to ensure your content gets through is to use inline-css. As pointed out, this is time consuming and a pain to maintain.

Fortunately the kind people over at mail chimp have developed a CSS Inliner tool.

So you can develop your email using CSS classes as you normally would, paste the html in to the tool, and receive correctly inlined CSS, perfect for emailing.

Takes a bit of tweaking and you need to declare everything, but it definitely does make life easier.

(e.g you have to declare font family, size and colour for p, h1, h2, h3, td, ul rather than just body, for instance).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...