{"id":1889,"date":"2015-07-30T20:44:18","date_gmt":"2015-07-30T20:44:18","guid":{"rendered":"http:\/\/freshinbox.com\/blog\/?p=1889"},"modified":"2016-04-06T19:28:31","modified_gmt":"2016-04-06T19:28:31","slug":"how-to-hide-checkbox-and-radio-in-email","status":"publish","type":"post","link":"https:\/\/freshinbox.com\/blog\/how-to-hide-checkbox-and-radio-in-email\/","title":{"rendered":"How To Hide Checkbox And Radio Inputs In Email"},"content":{"rendered":"<p><B>Update April 2016:<\/B> Outlook.com introduced a bug that modifies styles of elements next to checkboxes. Check out <a href=\"https:\/\/freshinbox.com\/blog\/outlook-com-alters-styles-of-elements-next-to-checkboxes\">this article<\/a> to learn more.<\/p>\n<p>Hidden checkbox and radio inputs are becoming a staple way to <a href=\"https:\/\/freshinbox.com\/blog\/hamburger-collapsible-menu-in-email\/\">introduce<\/a> <a href=\"https:\/\/freshinbox.com\/blog\/interactive-tabs-for-email\/\">interactivity<\/a> in email. Here&#8217;s a simple way to hide these elements in all email clients.<\/p>\n<div style=\"max-width:400px;margin:20px auto;padding:10px;border:2px solid #AC88AC;text-align:center;border-radius:3px;\">\nCan&#8217;t wait to get started with interactive email?<br \/>\n<a href=\"https:\/\/freshinbox.com\/resources\/tools\/carousel\/\">Try out the Image Carousel for Email Builder<\/a>.\n<\/div>\n<p><BR><\/p>\n<h4>Techniques that don&#8217;t work<\/h4>\n<p><a href=\"https:\/\/freshinbox.com\/blog\/bulletproof-solution-to-hiding-mobile-content-when-opened-in-non-mobile-email-clients\/\">Hiding techniques<\/a> vary over the different email clients so its tempting to add other fallback hiding tricks when hiding elements. Unfortunately, the typical methods to hide divs and tables don&#8217;t work on form elements and may result in odd spacing artifacts when <code>display: none<\/code> is not supported.<\/p>\n<p>Here&#8217;s how a checkbox looks like when we style a checkbox with <code>height: 0px; overflow: hidden<\/code> (before &amp; after):<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/freshinbox.com\/blog\/wp-content\/uploads\/2015\/06\/hide-checkbox-1.gif\" alt=\"hide-checkbox-1\" width=\"363\" height=\"152\" class=\"aligncenter size-full wp-image-1890\" \/><\/p>\n<p>As you can see, even with <code>overflow: hidden<\/code>, the checkbox is still visible and rendered over the next element.<BR><BR><\/p>\n<h4>This technique works<\/h4>\n<p>The solution that works is a simple one. Unlike the other hiding techniques, this requires adding a style into the  &lt;style&gt; block but it is relatively straightforward:<\/p>\n<pre class=\"lang:default decode:true \" >&lt;style&gt;\r\n.hide-input{\r\n  display: none;\r\n}\r\n&lt;\/style&gt;\r\n\r\n&lt;!--[if !mso]&gt;&lt;!-- --&gt;\r\n&lt;input type=\"checkbox\" class=\"hide-input\" style=\"display: none !important\"&gt;\r\n&lt;!--&lt;![endif]--&gt;<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/freshinbox.com\/blog\/wp-content\/uploads\/2015\/06\/hide-checkbox-2.gif\" alt=\"hide-checkbox-2\" width=\"363\" height=\"152\" class=\"aligncenter size-full wp-image-1891\" \/><\/p>\n<p>The technique uses three hiding tricks:<\/p>\n<ol>\n<li> Gmail only supports display: none when accompanied by !important.<BR><BR><\/li>\n<li> Yahoo! Mail does not support display: none inline but allows display: none in the embedded style.<BR><BR><\/li>\n<li> The trusty ol Outlook conditional comment to hide the element in Outlook.<\/li>\n<\/ol>\n<p><BR><\/p>\n<p>As you can see this works without the usual overflow, height, font-size, line-height, visibility baggage.<\/p>\n<p><BR><BR><BR><br \/>\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> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hidden checkbox and radio inputs are becoming a staple way to introduce interactivity in email. Here&#8217;s a simple way to hide these elements in all email clients&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1890,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23,2,24,47],"tags":[],"_links":{"self":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/1889"}],"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=1889"}],"version-history":[{"count":37,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/1889\/revisions"}],"predecessor-version":[{"id":2052,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/posts\/1889\/revisions\/2052"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/media\/1890"}],"wp:attachment":[{"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/media?parent=1889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/categories?post=1889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freshinbox.com\/blog\/wp-json\/wp\/v2\/tags?post=1889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}