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
519 views
in Technique[技术] by (71.8m points)

html - Outlook 2007 to 2013 Displaying Device Media Queries

I developed a custom email template that uses a media query to target devices smaller than 480px. The email looks and displays perfect in every email client and platform - Gmail, Yahoo!, Hotmail, Apple Mail, Thunderbird, Outlook 2003, etc - with the exception of Outlook 2007 to 2013.

Outlook 2007 to 2013 oddly picks up the media query and styles the email with the given css declarations. When I remove the media query, it renders perfectly. Any idea how I can have Outlook ignore the media query?

Below is the media query being used as well as a jsFiddle link. Change max-device-width to max-width to see the media query in action.


jsFiddle: http://jsfiddle.net/danimalnelson/uQ7kg/

@media only screen and (max-device-width: 480px) {
See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

You can force Microsoft to ignore parts of the code with:

<!--[!if gte mso 9]><!-->
 // This will be ignored by Outlook 2007
<![endif]-->

<!--[!if gte mso 15]><!-->
 // This will be ignored by Outlook 2013
<![endif]-->

<!--[if !mso]><!-->
 // This will be ignored by all Microsoft Outlook
<!--<![endif]-->

Here are the Outlook version numbers


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

...