{"id":1497,"date":"2015-03-03T15:08:23","date_gmt":"2015-03-03T15:08:23","guid":{"rendered":"http:\/\/freshinbox.com\/blog\/?p=1497"},"modified":"2015-10-07T11:02:16","modified_gmt":"2015-10-07T11:02:16","slug":"yahoo-mail-fixes-media-query-bug-yahoo","status":"publish","type":"post","link":"https:\/\/freshinbox.com\/blog\/yahoo-mail-fixes-media-query-bug-yahoo\/","title":{"rendered":"Yahoo! Mail Fixes Media Query Bug. Yahoo!!!"},"content":{"rendered":"<p>It looks like the folks at Yahoo! Mail are responsive (pun intended) to the email design and developer community. Less than a month after the <a href=\"https:\/\/freshinbox.com\/blog\/getting-yahoo-mail-to-fix-their-css-parser\/\">petition for Yahoo! Mail to fix their CSS parser<\/a> that causes emails with media queries to break, they have put in a fix for it. <\/p>\n<p>This is SERIOUSLY great news. Thank you Team Yahoo! Mail!<BR><BR><\/p>\n<h4>What This Means<\/h4>\n<p>All the hacks you had to add to your styles within media queries so that they don&#8217;t &#8220;activate&#8221; in Yahoo! Mail are no longer needed. The Yahoo! Mail CSS parser now handles nested CSS blocks properly and styles within media queries remain enclosed after the parser is done with it.<\/p>\n<p>Hacks that you no longer need to use in your email:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.campaignmonitor.com\/blog\/post\/3457\/media-query-issues-in-yahoo-mail-mobile-email\/\">Prevent Yahoo! Mail from displaying the mobile version of your email<\/a><BR> (Attribute selector hack)\n<pre>@media (...) {\r\n  table[class=foo]{...}\r\n}<\/pre>\n<p><BR>\n<\/li>\n<li><a href=\"http:\/\/www.emailonacid.com\/blog\/details\/C13\/stop_yahoo_mail_from_rendering_your_media_queries\" target=\"_blank\">Stop Yahoo! Mail from Rendering Your Media Queries<\/a> (Body attribute hack)\n<pre>\r\n@media (...) {\r\n  body[yahoo] .foo {...}\r\n}\r\n...\r\n<body yahoo=\"fix\">\r\n<\/pre>\n<p><BR><\/li>\n<li><a href=\"https:\/\/freshinbox.com\/blog\/why-not-to-put-regular-css-under-media-query-blocks-the-yahoo-mail-edition-part-1\/\">Why Not to Put Regular CSS Under Media Query Blocks<\/a><\/li>\n<\/ul>\n<p><BR><\/p>\n<h4>Yahoo! Mail Web and Mobile App Is Now Responsive<\/h4>\n<p>An icing on the cake is that not only does Yahoo! Mail support media queries, the Yahoo! Mail mobile app does as well! Yahoo! Mail supports a limited set of media queries but most importantly the ubiquitous min-width and max-width filters.<\/p>\n<p>So media queries such as these now work as designed in Yahoo! Mail and Yahoo! Mail app. (Note: Responsive content within Webmail will activate narrower than the max-width due to the 190px wide left navigation bar).<\/p>\n<pre class=\"lang:default decode:true \" >@media only screen and (max-width: 480px)  {\r\n  img { width: 100%; }\r\n}<\/pre>\n<p>However, max-device-width, min-device-width, -webkit-min-device-pixel-ratio are not supported. It appears media queries with more than one filter are not supported either.<\/p>\n<pre class=\"lang:default decode:true \" >@media screen and (min-width:321px) and (max-width:768px){\r\n  img { width: 100%;}\r\n}<\/pre>\n<p>becomes: <\/p>\n<pre class=\"lang:default decode:true \" >@media screen and (min-width:321px)and ( _filtered_a ){\r\n #yiv6584440300 img{ width:100%; }\r\n}<\/pre>\n<p><BR><BR> <\/p>\n<h4>Yahoo! Mail Supports Simple Attribute Selectors<\/h4>\n<p>With this change, Yahoo! Mail also supports the basic class and id attribute selectors, though more advanced selectors (non class\/id attributes and ^=, *=) are still stripped.<\/p>\n<p>These will work in Yahoo! Mail<\/p>\n<pre class=\"lang:default decode:true \" >div[class=foo]{\r\n  color:green;\r\n}\r\ndiv[id=foo]{\r\n  color:green;\r\n}<\/pre>\n<p><BR><BR> <\/p>\n<h4>Yahoo! Mail Client Targeting<\/h4>\n<p>Mark Robbins (<a href=\"http:\/\/twitter.com\/m_j_robbins\" target=_blank>@m_j_robbins<\/a>) of <a href=\"http:\/\/rebelmail.com\" target=_blank>RebelMail<\/a> also discovered a new way to target the Yahoo! Mail client. (Unfortunately, it appears this technique doesn&#8217;t work in IE10\/11) &#8211; An alternate way to target Yahoo! Mail is by <a href=\"https:\/\/freshinbox.com\/blog\/yahoo-mail-removes-css-under-comments\/\">leveraging a quirk<\/a> in how it handles comments.<\/p>\n<blockquote class=\"twitter-tweet\" data-conversation=\"none\" data-cards=\"hidden\" data-partner=\"tweetdeck\">\n<p><a href=\"https:\/\/twitter.com\/stigm\">@stigm<\/a> <a href=\"https:\/\/twitter.com\/FreshInbox\">@freshinbox<\/a> Looks like you can target yahoo with <a href=\"https:\/\/twitter.com\/media\">@media<\/a> yahoo{} &#10;Yahoo will change it to <a href=\"https:\/\/twitter.com\/media\">@media<\/a> nothing else I&#39;ve seen will render it<\/p>\n<p>&mdash; Mark Robbins (@M_J_Robbins) <a href=\"https:\/\/twitter.com\/M_J_Robbins\/status\/572749728229797888\">March 3, 2015<\/a><\/p><\/blockquote>\n<p><BR><\/p>\n<p>You can put CSS specifically for Yahoo! Mail like the example below and it will only be activated in Yahoo! Mail and nowhere else. (Use at your own risk :) )<\/p>\n<pre class=\"lang:default decode:true \" >@media yahoo{\r\n  .div1{width:200px;}\r\n}<\/pre>\n<p><BR><BR> <\/p>\n<h4>Test Your Existing Templates<\/h4>\n<p>This update may potentially affect templates that depended on Yahoo! Mail&#8217;s quirks, so I would run some tests through Yahoo! Mail to make sure everything&#8217;s A-OK. Hat tip to <a href=\"http:\/\/twitter.com\/stigm\" target=_blank>Stig Morten Myre<\/a> for kicking off this discussion and for suggesting the petition on <a href=\"https:\/\/yahoo.uservoice.com\/forums\/210695-yahoo-mail\/suggestions\/7053455-css-parser-should-not-break-responsive-emails-when\" target=\"_blank\">Yahoo! Mail&#8217;s forum<\/a>. <\/p>\n<p>Notice any new quirks? Pipe in in the comments below! The <a href=\"https:\/\/litmus.com\/community\/discussions\/1144-looks-like-yahoo-mail-finally-fixed-their-media-query-bug\" target=_blank>Litmus forum<\/a> also has some interesting discussion.<\/p>\n<p>Gmail, the ball&#8217;s in your court now. Time to support embedded styles and media queries! <a href=\"https:\/\/freshinbox.com\/blog\/gmail-can-has-style\/\">#CanHasStyle<\/a><BR><BR><\/p>\n<div style=\"padding:10px; border: 2px solid #99C731;background-color:#FFF8DC;border-radius:5px;\">\n<form action=\"https:\/\/freshinbox1.createsend.com\/t\/i\/s\/adrmi\/\" method=\"post\" id=\"subForm\">\n<span class=\"fisub_header\" style=\"font-weight:bold;\">Subscribe to the #EmailGeeks Newsletter<\/span>\n<p><input id=\"fieldEmail\" name=\"cm-adrmi-adrmi\" type=\"email\" style=\"width:90%\" required placeholder=\"Your Email Address\" \/><\/p>\n<p><button type=\"submit\">Subscribe<\/button><\/p>\n<\/form>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>It looks like the folks at Yahoo! Mail are responsive to the email design and developer community. Less than a month after the petition for Yahoo! Mail to fix their CSS parser that causes emails with media queries to break, they have put in a fix for it.<\/p>\n","protected":false},"author":2,"featured_media":142,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,28,46],"tags":[],"_links":{"self":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/1497"}],"collection":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/comments?post=1497"}],"version-history":[{"count":43,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/1497\/revisions"}],"predecessor-version":[{"id":1522,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/1497\/revisions\/1522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/media\/142"}],"wp:attachment":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/media?parent=1497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/categories?post=1497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/tags?post=1497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}