Filmstrip+ Interactive Email Technique: Adding Support For More Email Clients
Table of content
Filmstrip+ Clients Support
The following table shows support among the different email clients for both the windowed anchor technique which was covered in the original article and the for the :checked selector. I've also added CSS animation as well to demonstrate that our subset of clients that support the :checked selector also supports CSS animations. Since the presence of the :checked selector support generally means better CSS support overall for the clients we'd use opt to use the :checked selector for clients that support it so we can use more advanced CSS like CSS animations, which Gmail does not support.Email client | windowed anchor | :checked | CSS animation |
---|---|---|---|
Android 4.4 Native Client | |||
Apple Mail | |||
Gmail App (Android) | |||
iOS Mail | |||
Outlook for Mac | |||
Samsung Native Client |
Combination Technique
Aside from supporting Gmail, a key advantage of the filmstrip technique is its simplicity. Designers can create different "states" of an interactive email as named frames and stack them like a filmstrip. Then using named anchors these frames can be displayed. You can read the technique here. However there is a way to leverage the :checked state of radio buttons to mimic the filmstrip technique. The technique is to give each frame its own radio button and instead of a link to a named anchor, to use a label that targets a radio button. The radio button will shift the margin of the first frame upwards by a multiple of the height of the window time the position of the frame in the strip just like how the position would shift using the filmstrip technique.:checked implementation
Say you have two frames that are 200 pixels tall, if the user selects the second label, the second radio element is checked and the margin of the first frame is shifted up 200 pixels displaying the second frame. If you have 3 frames, youd shift the margin up by 400 pixels and so forth.<style>
.frame{
width:300px;
height:200px;
}
#radio2:checked ~ .container > .frame:first-of-type{
margin-top:-200px;
}
</style>
<input type="radio" name="choice id="radio1">
<input type="radio" name="choice id="radio2">
<div class="container frame" style="overflow:hidden;">
<div class="frame">
<label for="radio1">Tab 1</label>
<label for="radio2">Tab 2</label>
This is Frame 1
</div>
<div class="frame">
<label for="radio1">Tab 1</label>
<label for="radio2">Tab 2</label>
This is Frame 2
</div>
</div>
View example on Codepen
Combined Technique With Fallbacks
To combine the technique you'd have a set of both links and labels in your frames and you'd hide and display the links or labels depending on the capability of the email client. As mentioned, we'd only show the links in the Gmail app and labels elsewhere.<!--[if !mso]><!-->
<div class="interactive" style="display:none;max-height:0;overflow:hidden;">
INTERACTIVE CONTENT (PUT FILMSTRIP CODE HERE)
</div>
<!--<![endif]-->
<div class="fallback">
FALLBACK CONTENT
</div>
We'll also show the fallbacks on other email clients. Because we're changing our targeting mechanism, the CSS to show the interactive and fallback is different.
<style>
/* hide both buttons and labels */
.interactive .buttons a,
.interactive .buttons label{
display:none;
}
@media screen and (-webkit-min-device-pixel-ratio: 0){
/* Use :checked technique for:
iOS, Outlook Mac, Apple Mail, Samsung
- NOT Gmail */
.cbox-check:checked + * .interactive{
display:block!important;
max-height:none!important;
}
.cbox-check:checked + * .fallback{
display:none!important;
}
/* using labels */
.interactive .buttons label{
display:inline-block;
}
/* Blocker for AOL Mail
https://www.emailonacid.com/blog/article/email-development/css-targeting-for-aol-mail
*/
.cbox-check:checked + * div[class~="aolmail_interactive"]{
display:none!important;
}
.cbox-check:checked + * div[class~="aolmail_fallback"]{
display:block!important;
}
}
</style>