{"id":3319,"date":"2017-02-05T03:26:25","date_gmt":"2017-02-05T03:26:25","guid":{"rendered":"http:\/\/freshinbox.com\/blog\/?p=3319"},"modified":"2017-02-10T18:49:30","modified_gmt":"2017-02-10T18:49:30","slug":"hover-pseudo-class-limitations-on-ios-mail","status":"publish","type":"post","link":"https:\/\/freshinbox.com\/blog\/hover-pseudo-class-limitations-on-ios-mail\/","title":{"rendered":":hover Pseudo-Class Limitations on iOS Mail"},"content":{"rendered":"<p>Pseudo-classes such as :hover and :checked are work-horses of <a href=\"https:\/\/freshinbox.com\/resources\/techniques.php\">interactive email<\/a>. However you should be aware that the :hover pseudo-class will only activate on certain elements in the iOS email client and knowing this can save you some headaches when troubleshooting your interactive email designs.<\/p>\n<h4>Links, Images and Labels<\/h4>\n<p>The :hover selector will only be triggered if the element that is targeted is a link, image or a label. Since there is no &#8220;hover&#8221; action on touch devices, the :hover selector becomes activated when the user taps on an element.<\/p>\n<pre class=\"lang:default decode:true \" >&lt;style&gt;\r\n.mylink:hover{background-color:yellow;}\r\n&lt;\/style&gt;\r\n&lt;a href=\"#link\" class=\"mylink\"&gt;Hello&lt;\/a&gt;\r\n<\/pre>\n<p>Applying the :hover selector to other elements will do nothing when the element is tapped.<\/p>\n<p>Interestingly, the :hover selector will not be active on labels if the labels do not target a form element (ie. the &#8220;for&#8221; attribute in the label does not target an id of a form element).<\/p>\n<h4>Outlook iOS Anchor Quirk<\/h4>\n<p>It should be noted that in Outlook for iOS, when a user taps on a link with an anchor placeholder (ie href=&#8221;#test&#8221;) , Outlook will launch a browser and attempt to load the placeholder link. <\/p>\n<p>If you want to apply the :hover selector to a link (vs an image) and have them work in Outlook for iOS, a quick hack is to hide the link and replace it with another element when the :hover selector is active. This may cause the element to &#8220;flicker&#8221; when the :hover state is triggered in desktop environments like Apple Mail, so you may want to only use this trick with a combination of a media query.<\/p>\n<pre class=\"lang:default decode:true \" >&lt;style&gt;\r\n#link1:hover{display:none!important;}\r\n#link1:hover + #link2{display:block!important;}\r\n&lt;\/style&gt;\r\n&lt;a href=\"#r\" id=\"link1\" style=\"display:block\"&gt;my link1&lt;\/a&gt;\r\n&lt;a href=\"#r\" id=\"link2\" style=\"display:none;\"&gt;my link2&lt;\/a&gt;<\/pre>\n<p><BR><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>Pseudo-classes such as :hover and :checked are work-horses of <a href=\"http:\/\/freshinbox.com\/resources\/techniques.php\">interactive email<\/a>. <BR><BR><br \/>\nHowever you should be aware that the :hover pseudo-class will only activate on certain elements in the iOS email client and knowing this can save you some headaches when troubleshooting your interactive email designs&#8230;.<\/p>\n","protected":false},"author":2,"featured_media":3323,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,24],"tags":[],"_links":{"self":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/3319"}],"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=3319"}],"version-history":[{"count":11,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/3319\/revisions"}],"predecessor-version":[{"id":3328,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/3319\/revisions\/3328"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/media\/3323"}],"wp:attachment":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/media?parent=3319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/categories?post=3319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/tags?post=3319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}