![Filmstrip Techniques in Email](https://media.emailonacid.com/wp-content/uploads/2017/09/EOA_FilmstripTech_Blog-1200x675.jpg)
Introducing the Filmstrip Interactive Email Technique
Table of content
-
01
Windowed Named Anchors - Use 'name' and not 'id'
-
02
Support in Email Clients -
03
Advantages - Supported in major mobile email clients.
- Simple
- No CSS needed
- Better ESP support
-
04
Limitations - Lack of support in desktop and webmail.
- Not as flexible as the checkbox technique
- Container scrolls to the top of window in Android
-
05
Tabs Example -
06
Interactive Support Detection and Fallback - Adding vertical space in Android
-
07
Filmstrip+ and Next Steps - Don’t Guess, Test!
Windowed Named Anchors
The simplicity of the filmstrip technique lies in the use of named anchors. Yes, those a tags containing a name attribute that allow you to jump from one part of an email to the next.<a href="#foo">Click here</a>
<a name="foo"></a>
Content here...
By stacking blocks or frames of content separated by named anchors and placing them within a container that is sized to show only a single frame, you can display any frame by referencing the anchor name in a link.
![stacking blocks or frames](https://media.emailonacid.com/wp-content/uploads/2017/09/filmstrip-layout.png)
![film strip](https://media.emailonacid.com/wp-content/uploads/2017/09/film-pic.jpg)
<a href="#f1">One</a>
<a href="#f2">Two</a>
<a href="#f3">Three</a>
<div style="overflow:hidden;width:200px;height:100px;">
<a name="f1"></a>
<div style="height:100px;">Frame 1</div>
<a name="f2"></a>
<div style="height:100px;">Frame 2</div>
<a name="f3"></a>
<div style="height:100px;">Frame 3</div>
</div>
View example on Codepen
Use 'name' and not 'id'
Although the name attribute in anchors are technically deprecated in HTML5 in favor of simple ids, they still work in modern browsers. This technique will not work in the Gmail App if your link refers to an id instead of a name.Support in Email Clients
Update: Unfortunately due to a Gmail Android update, this technique no longer works on that client. The following table lists the email clients that this technique will work in. For the clients that don't support this technique, you'll need to ensure you have an alternative or fallback design to display in the other clients. Here's where Email on Acid comes in handy. Email on Acid's email testing lets you quickly see which of the dozens of email clients are rendering your fallback vs interactive design and if something is not looking right.Windowed Name Anchor Support | |
---|---|
Android 4.4 Native Client | |
AOL Mail | |
Apple Mail | |
Gmail App (Android) | |
Gmail POP/IMAP * (Android) | |
Gmail Webmail | |
iOS Mail | |
Outlook (Mac/Windows/iOS/Android) | |
Outlook.com Webmail ** | |
Samsung Native Client | |
Yahoo! Mail App (iOS/Android) | |
Yahoo! Webmail** |
Advantages
Supported in major mobile email clients.
Now you'll be able to design interactivity that the majority of users of email clients on iOS and Android can see. This technique works in the Gmail app for Android, Android 4.4 and Samsung native clients. This technique won't work in the Outlook, Yahoo! Mail and Gmail iOS apps as well as the Gmail Android app when set up with a non-Gmail account.Simple
No more long chains of checked and sibling selectors to deal with, it's just links and named anchors.No CSS needed
You still need CSS to style your email, but all the interactivity lies completely in HTML making the coding process straightforward. Although CSS is used to detect and control when to show the interactive and fallback versions, that code shouldn't need to be changed between designs.Better ESP support
Some email service providers (ESP) *ahem MailChimp!* strip checkbox and radio elements in emails which limited their customers' ability to send interactive email. Since this method only uses anchors, customers of these ESPs can finally send interactive email.Limitations
There's often tradeoffs when it comes to email design and this is no exception.Lack of support in desktop and webmail.
Although regular named anchors work in Gmail webmail, this technique does not work in Gmail webmail. Apple Mail and Outlook for Mac supports the older checkbox technique but this technique won't work in it. A follow up article will show ways to get support on the Mac using a combination technique.Not as flexible as the checkbox technique
The simplicity of the technique can also be a limitation. This filmstrip technique true to its namesake requires that all the interactive frames be of the same size. However, you can use media queries to create different fixed dimensions based on the size of the screen of the client (such as between tablet and mobile). Another feature of the checkbox technique is that you can toggle the display and hiding of elements such as a hamburger menu using the state of the checkbox. (I am experimenting with some techniques to achieve the same effect with the filmstrip technique).Container scrolls to the top of window in Android
In Android clients (Gmail, Inbox, Samsung and Android 4.4) when the recipient triggers an anchor, the email client will scroll the email so the the new frame is displayed right below top of the message window. So if your trigger links are above the container, the recipient will need to scroll your container down each time the recipient wants to click on a different link. In the Inbox App, the container will also be slightly obscured by the toolbar when the container is shifted. The detection and fallback code we will use will exclude the Inbox App.![shift-up-small](https://media.emailonacid.com/wp-content/uploads/2017/09/shift-up-small.png)
Tabs Example
The following is an implementation of interactive tabs using the filmstrip technique.![tabs example](https://media.emailonacid.com/wp-content/uploads/2017/10/tabs-demo2.gif)
![tabs layout](https://media.emailonacid.com/wp-content/uploads/2017/09/tabs-layout.png)
Interactive Support Detection and Fallback
We want to show a different block of content for clients that don't support windowed named anchors. We begin by showing the fallback by default and hiding the interactive content.<!--[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>
Then with CSS and media queries we can selectively enable interactivity only for supported clients. First we enable interactivity in iOS 10+ Mail clients using a @supports technique discovered by Rémi Parmentier. Note because Gmail strips out style blocks containing @supports, it needs to be placed in its own <style> block.
@supports (-webkit-overflow-scrolling:touch) and (color:#ffff) {
...
}
Next we enable interactivity by targeting Gmail and Inbox apps in Android. We do this by using a Gmail targeting technique pioneered by Mark Robbins that only targets the Gmail Android client. (I'm using a shortcut that requires you to not use the <u> tag in your email content).
/* This technique no longer works in Gmail on Android as of Nov 2017 */
/*
div > u ~ div .interactive{
display:block !important;
max-height:none!important;
}
div > u ~ div .fallback{
display:none!important;
}
*/
And finally we add the Samsung email client by targeting its unique container id of #MessageViewBody.
Verifying which version shows up on which email client can be a really tedious process. Email on Acid's email testing can help save you hours when building interactive designs as you'll be able to quickly see the impact of your code changes in over 60 different email clients in a single test.
The resulting interactive detection code below should be placed in the <head>:
<style>
/* Using @supports to ONLY target iOS Mail 10+ */
@supports (-webkit-overflow-scrolling:touch) and (color:#ffff) {
div[class^=interactive]{
display:block !important;
max-height:none!important;
}
div[class^=fallback]{
display:none!important;
}
}
</style>
<style>
/*
Enable for Gmail on Android
This no longer works as of Nov 2017
*/
/* div > u ~ div .interactive{
display:block !important;
max-height:none!important;
}
div > u ~ div .fallback{
display:none!important;
}
*/
/* Enable for Samsung App */
#MessageViewBody .interactive{
display:block !important;
max-height:none!important;
}
#MessageViewBody .fallback{
display:none!important;
}
</style>
Adding vertical space in Android
Having the interactive content hug the top of the window when the user interacts with it may not be visually pleasing. One solution is to specify a margin between the named anchor and the frame so that the frame appears below the toolbar. Alternatively you can include a static header at the top of each frame as a buffer.![adding vertical space](https://media.emailonacid.com/wp-content/uploads/2017/09/frame-margin.png)