<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Niven Ranchhod on Medium]]></title>
        <description><![CDATA[Stories by Niven Ranchhod on Medium]]></description>
        <link>https://medium.com/@nivenranchhod?source=rss-8178353afb77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zySQSzX5TZoadvMpJTVuEg.jpeg</url>
            <title>Stories by Niven Ranchhod on Medium</title>
            <link>https://medium.com/@nivenranchhod?source=rss-8178353afb77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 11:10:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nivenranchhod/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Parallax in Email with fallback — HTML Email Experiment]]></title>
            <link>https://nivenranchhod.medium.com/parallax-in-email-with-fallback-html-email-experiment-12f5d51a604b?source=rss-8178353afb77------2</link>
            <guid isPermaLink="false">https://medium.com/p/12f5d51a604b</guid>
            <category><![CDATA[html-email]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[parallax]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Niven Ranchhod]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 00:25:54 GMT</pubDate>
            <atom:updated>2023-12-19T20:29:27.594Z</atom:updated>
            <content:encoded><![CDATA[<h3>Parallax in Email with fallback — HTML Email Experiment</h3><h4>An HTML email experiment with a parallax scrolling effect. I break down the original idea, code behind the experiment and an appropriate fallback.</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2F2c482b99e4134b28bcfc5ac50d6ecde8&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fshare%2F2c482b99e4134b28bcfc5ac50d6ecde8%3Fsid%3D933d1553-07bb-4ccc-bd66-1ccba3ec01bd&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F2c482b99e4134b28bcfc5ac50d6ecde8-00001.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=loom" width="1280" height="960" frameborder="0" scrolling="no"><a href="https://medium.com/media/15ceb494976fdd9894f7452bf8898017/href">https://medium.com/media/15ceb494976fdd9894f7452bf8898017/href</a></iframe><blockquote>Originally posted on my personal blog in April 2023— <br><a href="https://bare-bones.dev/blog/parallax-in-email/">https://bare-bones.dev/blog/parallax-in-email/</a></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FNivenRanchhod%2Fembed%2Fpreview%2FgOqVXJE%3Fdefault-tabs%3Dhtml%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DgOqVXJE&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2FNivenRanchhod%2Fpen%2FgOqVXJE&amp;image=https%3A%2F%2Fshots.codepen.io%2Fusername%2Fpen%2FgOqVXJE-512.jpg%3Fversion%3D1702898953&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3cba370f4034975f5a3b6137216d69a/href">https://medium.com/media/f3cba370f4034975f5a3b6137216d69a/href</a></iframe><blockquote>Please note: This is not a mobile responsive project, so things will look squeezed and positioning on mobile will be out, but the main workings should be intact.</blockquote><p>Here is a fun little project I’ve been tinkering with for a wee while. I have wanted to play with an abstract email challenge for a long time but I just haven’t had the right project to spark that fire that makes me obsess over an idea.</p><p>One night this ad for Gousto (a recipe box company in the UK), popped up while we had the TV paused:</p><figure><img alt="A photo of the TV ad showing a hand sprinkling coriander leaves over a dish, with two lines of text placed in amongst the individual leaves to give a layered effect." src="https://cdn-images-1.medium.com/max/400/1*1hxpOKr3l5ClA9WZ-QLQ6w.jpeg" /></figure><p>I instantly thought of my favourite technique, faux absolute positioning. While I wouldn’t be able to recreate the design without the original image (which I couldn’t track down), I could take the premise and find an equally intricate image to pull off the same effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🏗️ Setup</h3><p>I scoured stock imagery sites until I found an interesting image:</p><figure><img alt="The stock image shows a hovering plate with seven pieces of sushi, sesami seeds, seeds and garnish falling in the direction of the plate" src="https://cdn-images-1.medium.com/max/400/1*73PYl2u6B17SsiGtZwEaiQ.jpeg" /></figure><p>First port of call was to remove the background and then split the elements up into separate layers so I could insert some text in amongst everything.</p><p>Here is a simple mockup I created once everything was cut out, to get an idea of how I could build it:</p><figure><img alt="The same stock image now cut up and pieced back together in the same formation as the original to allow me to add the text ‘I love Sushi’" src="https://cdn-images-1.medium.com/max/400/1*iodoGy6CWpEfrHkyiY1ZJQ.jpeg" /></figure><p>I’m not great with words and “I love Sushi” was the best I could come up with 😂 <br>I tweaked it slightly during the build, to include a heart shaped piece of sushi so it reads slightly better now, but I digress.<br>In the end, there will be some overlap between the layers, but the main goal is keep that text as live text.</p><p>It was around this time I remembered that I’ve always wanted to attempt a parallax effect in email. <br>This technique was new to me, in implementation. Even on the front end, I hadn’t ever used or even played with CSS based parallax, so I had some homework to do before I could see if this would even work in any email clients.</p><p>But first, some reflection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🫗 One for the homies</h3><p>In the past, the community has come up with a great alternative to parallax, in fixed/absolute positioning. A great example of this is the infamous <a href="https://parcel.io/e/666b2172-828c-40cf-9fd0-f84e8deec8a7">Taco Bell</a> email by <a href="https://twitter.com/SwissWebMiss?t=Obxgbym7lDJYk-nzoVeXiw&amp;s=09">Heidi Olsen</a>. Heidi was kind enough to share a little background and the actual code to this email. <br>Well worth a look if you haven’t seen it before:<br>➡️ <a href="https://parcel.io/e/666b2172-828c-40cf-9fd0-f84e8deec8a7">Heidi’s fixed position email</a><br>➡️ <a href="https://litmus.com/community/discussions/5118-using-z-index-and-fixed-positioning-to-create-a-scrolling-experience">Heidi’s write-up on the Litmus forum</a></p><p>Email on Acid then built their own version a year or so later, improving on Heidi’s idea, with better email client support, utilising… faux absolute positioning! That technique just gives and gives and gives.</p><p>Again, well worth a look to see where they made improvements over Heidi’s idea.<br>➡️ <a href="https://marketing.emailonacid.com/happy-halloween">EoA’s Halloween fixed position email</a><br>➡️ <a href="https://www.emailonacid.com/blog/article/email-development/how-we-created-out-interactive-scrolling-halloween-email/">EoA’s write-up</a></p><p>And there are plenty more examples in our community, I’ve only scratched the surface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🧮 The game plan</h3><p>Going into this, I knew most of the ins and outs of the faux absolute technique, from my work on the <a href="https://www.emailonacid.com/blog/article/email-development/faux-absolute-positioning/">multi-axis faux absolute module</a> for a client project at <a href="https://www.mailix.com/multi-axis-faux-absolute-positioning-in-html-email/">Mailix</a>, so I knew the approach to take and the email client support.</p><p>I also knew that parallax wouldn’t be easy, otherwise we’d see it used more often. And if it was supported even in one email client, it would be treated as a progressive enhancement on top of a more solid base. And that was my goal. Faux absolute as a strong, well supported base for the majority of email clients and parallax as a bonus, if it is even supported.</p><p>I mentioned this earlier but I think it’s important to note again — I decided not to go down the rabbit hole of making this responsive. I just wanted it to work and there is so much positioning involved that it would be a hell of a job adapting everything as the whole project scaled. If you test this out, you will definitely see some small positioning issues on mobile, but that’s okay. The main point is to show parallax working in Apple’s own mail client(s).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🛠️ Main build</h3><p>I urge you to look into the faux absolute positioning technique if you haven’t already. Basic premise is to wrap all of the elements you want to layer over the top of each other, in divs (I’ve only tested with divs, but may work with a span or even a table) individually, set the max-height to 0 on those divs which in-turn makes them trick each other into thinking everything is zero’d out. Then play with the max-height value of each div to push surrounding elements down or use absolute positioning, margin or padding to push your elements around. Outlook still requires VML to make this work but VML supports position absolute which is way easier to use 🥳</p><p>Here is the base build with wording tweak included 😉:</p><figure><img alt="A preview of the base project build using faux absolute positioning, with the text now reading ‘I heart Sushi’" src="https://cdn-images-1.medium.com/max/400/1*EtUEpTxtPi61hpNYmArVHg.jpeg" /></figure><p>Rendering results were as expected. It worked everywhere except GMX, Web.de, T-Online.de and Comcast. Comcast I can’t do too much about as I’m not US based and cannot get an account to test.</p><p>GMX, Web.de, T-Online.de all require inline CSS. This project required a fair amount of CSS because of the targeted fixes, so I’m not going to set up the inlining just for these three clients, considering it’s an experiment. However, it would be simple enough to fix for a typical faux absolute + parallax build with full width blocks and a few small elements layered over the top.</p><p>tl;dr — I can’t be arsed fixing the build for these clients since they’ve made it incredibly more difficult to code emails. It’s just silly and ultimately this is just an experiment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🪄 The magic</h3><p>And now the fun but laborious process of getting an understanding of CSS based parallax.</p><p>First and foremost, it is imperative you read up on this technique using the best resources available.</p><ol><li>Keith Clark’s <a href="https://keithclark.co.uk/articles/pure-css-parallax-websites/">Pure CSS Parallax Websites </a>— a lot of detail and scenario work in this how-to. Keith includes some good examples to illustrate how the CSS mimics layers and then how they work with helpful interactive &amp; scrollable diagrams.</li><li>Chrome Developers <a href="https://developer.chrome.com/blog/performant-parallaxing/">Performant Parallaxing</a> (originally written by Paul Lewis) — another in depth breakdown with some basic examples of how the properties work in conjunction.</li><li><a href="https://www.goodemailcode.com/">Mark Robbins</a> also adapted one of the examples included in the Chrome Developers post, for <a href="https://parcel.io/e/495df74b-ac1b-4de6-8df3-1a11f4f7d8cf">his testing in email clients</a>.</li></ol><p>This technique is heavily reliant on these three properties:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/perspective"><strong>perspective</strong></a> — defines the distance of an element from the user.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform"><strong>transform</strong></a> — value of <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translateZ"><strong>translateZ(#)</strong></a> determines the layer depth and subsequent scrolling speed + <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale"><strong>scale(#)</strong></a> scales the element back up to the originally intended size.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-style"><strong>transform-style</strong></a> — value of <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-style"><strong>preserve-3d</strong></a> indicates the children of the element, will be positioned in a 3D space.</li></ul><p>First thing to do was to check all of these properties in <a href="http://caniemail.com/">caniemail.com</a>.</p><ul><li><strong>perspective</strong> — not documented yet.</li><li><a href="https://www.caniemail.com/features/css-transform/"><strong>transform</strong></a> — has great support but that is to be expected as this property isn’t specifically for 3D CSS.</li><li><strong>transform-style </strong>— not documented yet.</li></ul><p>That is unfortunate, but understandable. Two of those properties aren’t in everyday use for email. Ahh well. Time to test.</p><p>I sent <a href="https://parcel.io/e/495df74b-ac1b-4de6-8df3-1a11f4f7d8cf">Mark’s adapted parallax test</a> to Litmus first, to see if <strong>transform:translateZ(#);</strong> was being respected. Without this, the scrolling speed variance can’t be set, to give the illusion of distance. Thankfully it was working in Apple Mail, but the 3D properties weren’t taking any effect in any other client.</p><p>While the <strong>translateZ</strong> value was being respected in Apple Mail, I still needed to test if the scrolling speed variance effect worked, which I can only do with a manually manipulated Apple device. Weird wording, but you’ll see what I mean shortly.</p><p>I only have a Windows laptop and an Android phone. My partner has an iPad but she gets a lot of use out of it for her business and artwork and I need a more accessible option, especially when I’m running rounds and rounds of tests. My best option was to set up a virtual Mac on my laptop and reserve the use of the iPad for some final testing. Setting the VM up took maybe a couple of hours including research, downloading files and then setting up the latest available version of the OS.</p><p>With that all set up, sending the test to my new test iCloud address, I could see the scrolling working as expected 🙀</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2Fa5c979e35fcb46bcbed5fb2c2e0d7592&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fembed%2Fa5c979e35fcb46bcbed5fb2c2e0d7592&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2Fa5c979e35fcb46bcbed5fb2c2e0d7592-00001.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=loom" width="1346" height="1009" frameborder="0" scrolling="no"><a href="https://medium.com/media/8533f77debc0764ed92219e74f365e9d/href">https://medium.com/media/8533f77debc0764ed92219e74f365e9d/href</a></iframe><p>It may not look like much but think about how all of those elements would usually react or rather not react when the viewport scrolls. They would stay static, keeping their initial distance between each other while the body shifts up. However, in this test, the distance between each element changes. That is the scroll speed variance I’m on about. The scroll speed of each element differs and so they are individually reacting to the scrolling action of the viewport.</p><p>Now, on to testing the properties on my build. Unfortunately, it wasn’t as easy as applying the parallax properties to my faux absolute base to enhance the build for Apple Mail. The 3D properties completely throw out the faux absolute positioning values.</p><p>I found that I had to set up separate positioning values for the parallax build. And to be honest, it was just less of a headache overall having the approaches split up in styles blocks in the head.</p><p>Once all of the elements were set up for the parallax build, I fired off another test to iCloud.</p><p>Boom! Winner winner chicken dinner!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2F14a9d77c33be480492499e0cf16d4a85&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fembed%2F14a9d77c33be480492499e0cf16d4a85&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F14a9d77c33be480492499e0cf16d4a85-00001.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=loom" width="1346" height="1009" frameborder="0" scrolling="no"><a href="https://medium.com/media/86303297bac0e418340e90ed86e48673/href">https://medium.com/media/86303297bac0e418340e90ed86e48673/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🪛 Fine tuning</h3><p>I now needed to ensure my parallax property overrides are enabled in Apple Mail and leave the faux absolute base in place by default.</p><p>The always reliable <a href="http://howtotarget.email/">howtotarget.email</a> gave me this selector to target all Apple Mail from version 10 and up:</p><pre>.Singleton .your-class-name {<br>  /* Replace this comment with your styles */<br>}</pre><p>This only enabled it for desktop and so I found this combo of selectors in an attempt to enable the build for ios mail on iPads and iPhones:</p><pre>@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2), <br>(min-resolution: 2dppx) and (hover: none) {<br>  _:-webkit-full-screen, <br>  _::-webkit-full-page-media, <br>  _:future, <br>  :root body:not(.Singleton) .your-class-name {<br>    /* Replace this comment with your styles */<br>  }<br>}</pre><p>However, I encountered some conflicts. I tested a bunch of variations of that combo but found reducing it down to just this selector, did the trick:</p><pre>:root body:not(.Singleton) .your-class-name { <br>  /* Replace this comment with your styles */<br>}</pre><p>Again, these two sets of selectors are split up into two separate style blocks, so they’re easy to distinguish. I now have three, one for faux absolute and two for the different Parallax enablers, depending on which Apple device you’re on.</p><p>With the selectors in place, I could now see smaller iOS devices showing my build and so it was finally time to steal my partner’s iPad for a live test and oh man, did it not disappoint. A bonus was seeing how smooth the parallax effect looks on an iPad. Especially when you scroll back to the top and see the rubber band scroll bouncing effect, accentuates the beauty.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F895972629%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F895972629&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1770958544-f167b9e99ce185a45133a2820a30c5bff4f86dd8f782ef1890eb0c344d914351-d_640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="720" height="900" frameborder="0" scrolling="no"><a href="https://medium.com/media/9928488e4a9c2b16f9d94a2dce348e10/href">https://medium.com/media/9928488e4a9c2b16f9d94a2dce348e10/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🧑🏾‍🦯 Accessibility</h3><h4>🌀 Reduced Motion</h4><p>Obviously, with parallax comes motion and especially with this build and the many variations on the scroll speed etc, I thought it would be best to include a way for the build to be respectful of everyone’s preferences. So, my two Parallax style blocks are now wrapped in a no-preference reduce-motion media query. <br>E.g.:</p><pre>@media (prefers-reduced-motion: no-preference) {<br>  …<br>}</pre><p>Now, when a user has set a device motion effect setting off on their device, the faux absolute position build will render, if on a device (online view) or in an email client (Apple Mail / iOS Mail) that supports the required properties.</p><h4>🖥️ Screen Readers</h4><p>There wasn’t a huge amount I needed to do here:</p><p>1. There is only one line of text, the H1. It’s live text, so assistive tech friendly and can be translated into other languages.</p><p>2. The majority of the images are decorative and the text gives context to my message.</p><p>3. The one image that will need to give context is the heart shaped sushi nested inside of the H1.</p><p>Let’s tackle point 3:</p><p>Simply adding the word “heart” to the alt attribute will then mean a screen reader will read:</p><blockquote>heading<br>level 1<br>I<br>graphic<br>heart<br>Sushi</blockquote><p><em>*Using Litmus’ NVDA screen reader</em></p><p>The announcement of a graphic being included in the middle isn’t ideal, as it breaks the flow of the text and may also in fact break the context I want to include. So instead, I’ve opted for hiding the image from screen readers by leaving the alt attribute empty and instead adding a screen reader only string with the text “heart”.</p><p>Those who can see the imagery, will see:</p><blockquote>“I ❤️ Sushi”.</blockquote><p>Those using a screen reader will hear:</p><blockquote>heading<br>level 1<br>I<br>heart<br>Sushi</blockquote><p>Or:</p><blockquote>“I heart Sushi”.</blockquote><p>I went with “heart” for screen readers, so the context matches, no matter how you consume the content.</p><p>Is that the best approach? I don’t know. My aim is to give as close to the same experience to everyone and I think that is what I’m doing. Happy to be corrected though.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XnTsg-CmyrTLkINB5X7cTA.png" /></figure><h3>🏁 Conclusion</h3><p>Obviously this is an extreme example of how to use a combo of faux absolute with parallax as a progressive enhancement, but for me that’s the fun of learning new techniques.</p><p>I find it difficult to pick up advanced techniques just by reading, in fact I very often inadvertently wander with my thoughts and get distracted and have to reread long posts, many times abandoning them. And usually I learn something new while in the middle of a project, rather than building a test specifically to learn that new thing. That helps keep me engaged because I’m deep in thought on how to achieve something for a client or excited to build a crazy idea, like this.</p><p>The thrill for me comes with the initial excitement of an idea, the frustration of my implementation of a new technique into my project not working and then the overwhelming feeling of accomplishment of getting over that hurdle and sharing it with others.</p><p>I hope that inspires others to experiment, whether it be with something like this or just a crazy idea they have.</p><p>Thanks for reading,<br>Niven</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*FrdFD1HquDY32aYoRjy6Ww.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12f5d51a604b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Colour Scheme Switcher — Interactive HTML Email Experiment]]></title>
            <link>https://nivenranchhod.medium.com/colour-scheme-switcher-interactive-html-email-experiment-b534a6040206?source=rss-8178353afb77------2</link>
            <guid isPermaLink="false">https://medium.com/p/b534a6040206</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Niven Ranchhod]]></dc:creator>
            <pubDate>Thu, 20 Oct 2022 23:20:21 GMT</pubDate>
            <atom:updated>2022-10-20T23:20:21.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Colour Scheme Switcher — Interactive HTML Email Experiment</h3><p>Inspired by a beautiful <a href="https://dribbble.com/shots/14630755-Cards-Dark-UI">dark mode toggle design</a> on Dribbble, I decided to translate this for use in email.</p><figure><img alt="A preview of the final result of the light &amp; dark mode toggle built with HTML &amp; CSS, for email." src="https://cdn-images-1.medium.com/max/657/0*Z6WvNv_UTZqIR0N2.jpg" /></figure><p>🔗 <a href="https://bare-bones.dev/code/colour-scheme-switcher"><strong>View the colour scheme toogle experiment</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*pz3wTju5ccAD-Lst9yPSpQ.png" /></figure><h3>💡 The idea</h3><p>One day, while perusing Dribbble for interactive email design inspiration, I stumbled upon this lovely little <a href="https://dribbble.com/shots/14630755-Cards-Dark-UI">dark card UI design</a>.</p><p>Lately, I’ve had a real desire to build out some of the amazing web &amp; mobile design work that is constantly being shared on Twitter, Dribbble, newsletters and a myriad of other places.</p><p>This toggle design really stood out to me and stumbling upon it coincided with some research I was doing into colour scheme toggles for fun, which is something I find enjoyable apparently…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*pz3wTju5ccAD-Lst9yPSpQ.png" /></figure><h3>🔨 Build — The Basics</h3><p>Building a toggle is actually really simple.<br>A checkbox with one label or two radio inputs with two labels. The labels are then used as a click/tap area to trigger the ‘checked’ state on the checkbox or respective radio input and then our CSS will shift the handle/indicator to the specified position.</p><h4>Example:</h4><p><a href="https://parcel.io/e/89f168c6-c2ec-4490-b5d9-3c8f551fe68f?parts=html&amp;default-part=html&amp;preview-size=500&amp;theme=parcel-dark&amp;layout=split">Basic toggle examples - Parcel</a></p><p>I’ve outlined the labels in red. Have a click around to see how the two different techniques work.</p><p>The difficulty with builds like this comes when you add visual complexity, like in my final build where I’ve included lighting and shadows.</p><p>In general, it’s all about using CSS to check for changes on your inputs and then styling your views for the different scenarios, i.e. disabled / enabled.</p><p><strong>Example:</strong></p><pre>.traffic-light { background-color:red; }<br>#green-light:checked ~ .wrapper .traffic-light { background-color:green; }</pre><p>This toggle could be pushed further with more options added to transform it into a slider. We simply add more radio input options (checkboxes won’t work here unless you want a multi-choice slider, if that is a thing), lengthen the track and add CSS to tell the handle to travel further for each added option, when selected.</p><h4>Example: (may not work too well on mobile)</h4><p><a href="https://parcel.io/embed/dcd2de1a-a535-443a-a308-644be427dccf?parts=html&amp;default-part=html&amp;preview-size=500&amp;theme=parcel-dark&amp;layout=split">Slider example - Parcel</a></p><p>At Mayoris, we utilise sliders in our interactive email API — Mailix, for our clients to pull into their survey builds for NPS ratings or as an alternative to a list or grid of radio input options.<br>And the work to adapt this to a horizontal layout for mobile is quite simple.</p><h3>Radio or Checkbox?</h3><p>Back to the toggle…<br>Before we make it look pretty, we need to choose between the radio and checkbox methods.</p><p>My thinking here is:<br><strong>a.</strong> Two radio inputs means the user can see that they are explicitly enabling either colour scheme. This will work well for a larger toggle to allow for the same functionality on mobile, without having to rework the element.</p><p><strong>b.</strong> One checkbox means a smaller toggle can be used and simply tapping the toggle element as a whole will toggle between the two states.</p><p>I’m more of a fan of explicitly telling the user which setting they’ll be enabling upon click/tap, plus I’m building the toggle to be quite large, so the radio input option (option a) just makes sense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*pz3wTju5ccAD-Lst9yPSpQ.png" /></figure><h3>🔨 Build — Make it Glitter</h3><p>We want the colour scheme state to affect the entire body. To make this work, the inputs need to sit above everything else. The reason being — we watch the inputs for changes (unchecked / checked) and once a state change is made, we then use <a href="https://css-tricks.com/child-and-sibling-selectors">CSS sibling selectors</a> to run down the HTML to find and style our elements accordingly.</p><p><strong>Example:</strong><br>This is one of the selectors I’m using to switch out the dark mode icon when enabled.</p><pre>#dark-mode:checked ~ .wrapper .toggle .dark { ... }</pre><p>In shifting the inputs to sit above everything else, I dropped them directly below the body tag (the highest in the heirarchy we can go), with the wrapping content div following closely behind.<br>I then added a class of ‘wrapper’ on that wrapping div and now I can check for the <em>checked</em> input state, select my sibling .wrapper div and now I have access to my content structure for styling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*pz3wTju5ccAD-Lst9yPSpQ.png" /></figure><p>If you’ve taken a look at the source code, you’re probably (rightly) horrified. That’s a lot of CSS just to switch the styles of an element and the body, for each colour scheme! And then we have a dark mode media query with styles that force the light mode colour palette on devices that have dark mode enabled but the light mode option enabled in the email.</p><p>Baaaaaah 🤯</p><p>That’s just the way it is for a detailed build like this.<br>It’s beautiful and I find technically challenging builds like this fun, but it was a pain in the butt to build at times.</p><p>To be fair, I’ve gone all out to build a <em>beautiful</em> toggle. I mean, I even Skeumorphised this with shadows &amp; lighting. This could be simplified in so many ways to reduce the number of elements that are being adapted for each colour scheme.<br>Just look at my toggle examples in the ‘Basics’ section. They’re super basic and with the right colour palette, you can easily show the different states of the toggle, without going over the top like I did.</p><p>I know I didn’t go into too much detail on adapting the styling to suit the final result but I wanted to keep this tutorial at a reasonable length. Plus, this is mostly basic CSS styling. The intricacies are in the selection of each item and linking them with the :checked state on the radio inputs.</p><p><a href="https://bare-bones.dev/code/colour-scheme-switcher">View the final experiment</a> and comb through the source code to really see how each state change on the radio inputs is affecting ALL of the other elements. It’s all yours to play with, adapt and use as you wish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*pz3wTju5ccAD-Lst9yPSpQ.png" /></figure><h3>🤔 Final thoughts</h3><p>I do want to make it clear that I am a big proponent of pushing email to it’s limit, especially when it comes to mimicking web functionality in email and I am a firm believer that innovation is the avoidance of stagnation.<br><em>Someone quote that ^</em> 😅</p><p>This innovation could make sense in email or it could be experimenting web &amp; app functionality to open up gateways to more practical solutions for email.</p><p>Our community is exploding with development talent and excitement around being an email developer and that is all thanks to the years of innovation by the previous wave of developers — who were confined in an old box with sides that don’t conform, at the bottom of a pile of other boxes while being a sitting duck to random acts of God (Word rendering engine) that flood, water damage or burn the box.</p><p>Ridiculous analogy, I know but no more ridiculous than trying to explain email development and all of it’s quirks to a layman.</p><p>Hmm… I feel another blog post coming on.</p><p>Point is, let’s not allow our development capabilities in email, to stagnate. This toggle experiment is merely a gateway to more practical usecases.<br>This is what we need more of in our community — idea exploration, documentation and sharing of the findings.</p><p>Expect a lot more of this from me.</p><p>Thanks for reading, fellow geek.<br><a href="https://twitter.com/NivenRanchhod">Niven</a></p><p><strong>🔗 </strong><a href="https://bare-bones.dev/blog/colour-scheme-switcher-email-experiment/"><strong>This was originally posted on the Bare Bones blog</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*pR20krf6KnCYoRdwqHjmyA.png" /></figure><h4>Interested in seeing more experiments &amp; tutorials?</h4><p>📥 <a href="https://www.getrevue.co/profile/Barebonesclub"><strong>Sign up for the Bare Bones mailing list.</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b534a6040206" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uber email receipt vs. Outlook — an exclusive take from an email developer]]></title>
            <link>https://nivenranchhod.medium.com/uber-email-receipt-vs-outlook-an-exclusive-take-from-an-email-developer-2894d47d6d0c?source=rss-8178353afb77------2</link>
            <guid isPermaLink="false">https://medium.com/p/2894d47d6d0c</guid>
            <category><![CDATA[outlook]]></category>
            <category><![CDATA[email-marketing]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[uber]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Niven Ranchhod]]></dc:creator>
            <pubDate>Thu, 04 Aug 2022 14:55:18 GMT</pubDate>
            <atom:updated>2022-08-04T14:55:18.853Z</atom:updated>
            <content:encoded><![CDATA[<h3>Uber email receipt vs. Outlook — an exclusive take from an email developer</h3><p>I did a deep dive into the HTML template causing so much strife for Outlook and got a little obsessive along the way.</p><p><strong>Original story by Bleeping Computer:</strong><br><a href="https://www.bleepingcomputer.com/news/microsoft/microsoft-outlook-is-crashing-when-reading-uber-receipt-emails/">https://www.bleepingcomputer.com/news/microsoft/microsoft-outlook-is-crashing-when-reading-uber-receipt-emails/</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FHteV6g0QTNxp6%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FHteV6g0QTNxp6&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNzZiZGxycmZ5eHJ3ZGt3OGMxZjY0MnViY2Eya20wMXB0NDRvZTJkbiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FHteV6g0QTNxp6%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/571360606d688bfe8ef7b6c50b9ae560/href">https://medium.com/media/571360606d688bfe8ef7b6c50b9ae560/href</a></iframe><h3>📖 How it started</h3><p>The email community was having a field day with this. As soon as the news started circling about an email that was finally able to take down the mighty Outlook desktop application (which is notorious in it’s own right for being a poor experience), we were trying to figure out what could have possibly caused the bug.</p><p>The description ‘complex tables’ was thrown about like anyone knew what that actually meant. One eagle eyed community member found an <a href="https://reallygoodemails.com/emails/personal-your-tuesday-morning-trip-with-uber">example of a recent Uber email receipt</a> dating back to May 2022, saved on <a href="https://reallygoodemails.com/">Really Good Emails</a>. She was able to pull the source code and share with the community.</p><p>I jumped at the chance to try and figure out what the issue actually was as well as get a peek behind the curtain on how a global company of this size, codes their emails. <br>Let’s just say, I was impressed but for all the wrong reasons 😔</p><h3>👷🏾‍♂️ Let’s get technical</h3><p>First I dropped the source code into <a href="https://parcel.io/">Parcel</a> and skimmed through the HTML.<br>Parcel has helpful tools in it’s editor, such as:</p><ul><li><strong>Inspect Element</strong> — Click any HTML element in the preview to jump to the corresponding code.</li><li><strong>Focus Mode</strong> — Highlights and scroll the HTML element you are editing into view.</li><li><strong>Expanded Table View</strong> — Outline table elements to easily debug table-based layout issues.</li></ul><p>I cannot emphasise enough, how helpful these extra editor tools were to debugging this email. Without them, I think this would have taken twice the time to review. And they’re included in the Free plan, which I’m on.</p><p>Thanks Parcel 👍🏾</p><p><em>*cough* sponsor me…</em></p><p>—</p><h4><strong>Container</strong></h4><p>On initial review, I noticed a worrying trend… Numerous layers of nested tables for each section of the template.<br>On top of that, an attempt at a fluid setup for the structure with some of the wrapping tables using max-widths (which Outlook doesn’t support) and then a MSO or Outlook specific table with a fixed width (to fix the lack of max-width support).</p><pre>&lt;!--[if (gte mso 9)|(IE)]&gt;&lt;table width=&quot;700&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&gt;<br>    &lt;tr&gt;<br>        &lt;td&gt;<br>&lt;![endif]--&gt;<br>            &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border:none;border-collapse:collapse;border-spacing:0;max-width:700px;mso-table-lspace:0;mso-table-rspace:0;width:100%&quot; class=&quot;wrapper&quot;&gt;</pre><p>This setup is completely normal, but to see it being used on almost every layer of the nested structure, is simply not necessary.</p><p>This is how the email looked with the ‘Expanded Table View’ switched on:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*-7tkal3kHxkC0IfSZsQkaA.jpeg" /><figcaption>A screenshot of the ‘Expanded Table View’ in Parcel, showing the multiple layers of nested tables.</figcaption></figure><p>I discovered there were five extra tables wrapping the outer 700px wide container.<br>Removing these extra tables resulted in 38 lines of code being removed and a drop in file size by 33kb. <br>I mean, that is huge! <br>The email originally weighed in at 172kb. It’s now sitting at 139kb, after this removal.</p><p>—</p><h4>Header</h4><p>The header was also wrapped in another six tables 🤯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*cjPWoWKA9OO6FbQzv_TW0Q.png" /><figcaption>Screenshot of the header area and it’s contents of the Uber email in question</figcaption></figure><p>Designs like this are rather simple to lay out.</p><ol><li>One full width table which has the background colour and vertical padding.</li><li>A centred inner table of the intended width, with the two elements sitting in two columns since they stay side by side on smaller screens.</li></ol><p>That’s two tables. <br>Four extra tables doesn’t seem like a lot, but removing these resulted in a 5kb reduction in HTML file size.</p><p>5kb doesn’t sound like a lot, but in a world where Gmail clips emails larger than 102kb, a 5kb saving can be huge.<br>The amends to the header meant we were sitting at 134kb.</p><p>—</p><h4>🏃🏾‍♀️And on and on…</h4><p>The themes from the points above continue on for all sections.<br>Extra tables with CSS being applied at different stages. <br>In some cases, padding was being applied vertically in one layer and then one or two layers further in, horizontal padding was being applied.</p><p>Other issues I found:</p><ul><li>Heavy multi-table faux columns. 13 lines of code to mimic a table column. Hints at a mix of development styles by multiple developers.</li><li>100% width Outlook fallbacks for 100% width tables. Effectively, this doubles the code for no reason.</li><li>A lot of unused CSS in the head. A hangover from a templated system. This isn’t too concerning but making CSS in the head conditional depending on the use would make savings in file size too.</li><li>Class names for mobile styles are all doing the same thing. In this case, the .full class name (at the bottom of the list) would have sufficed.</li></ul><pre>@media screen and (max-width:699px) {<br>.t1of12,<br>.t2of12,<br>.t3of12,<br>.t4of12,<br>.t5of12,<br>.t6of12,<br>.t7of12,<br>.t8of12,<br>.t9of12,<br>.t10of12,<br>.t11of12,<br>.t12of12,<br>.full { width: 100% !important; max-width: none !important; }<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F12bVDtXPOzYwda%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F12bVDtXPOzYwda%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F12bVDtXPOzYwda%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/61e136c20de78587d2bde69dd114b915/href">https://medium.com/media/61e136c20de78587d2bde69dd114b915/href</a></iframe><p>—</p><h4>🦾Accessibility</h4><p>I ran the original code through the Litmus accessibility checker and found these results:</p><ul><li>Images are missing alt attributes</li><li>&lt;html&gt; is missing a lang attribute</li><li>A large number of presentational tables are missing a role attribute to inform screens readers to ignore their structure.</li></ul><p>These are the basics for email accessibility, especially alt attributes on images, even if empty.<br>Not a good look.</p><h3>Conclusion</h3><p>Outlook crashing or being crippled by HTML absolutely shouldn’t be happening! <br>The Outlook team pushing out a hot fix, begs the question… Why can’t they do the same to fix the numerous issues with how Outlook renders HTML, which have plagued developers for years and over multiple versions of the software?</p><p>On the flipside, why is a Unicorn like Uber unable to produce standard HTML email templates? <br>There is a flourishing community of <a href="https://email.geeks.chat/">#emailgeeks</a> sharing how to build and deliver emails in a standard and accessible way. <br>We now also have the <a href="https://emailmarkup.org/">Email Markup Consortium</a>, made up completely of community members, attempting to help the community and ESPs set standards for everything email.<br>Resources are in reach.</p><p>I’ve been building emails for eight years now. I’ve seen email templating systems of all sizes in my time, but never anything this poorly built and managed. And it’s sad to see such poor accessibility integration.</p><p><strong>⚠️ I must emphasise…</strong><br>There is actually nothing complex about the table structure being used in this template. ‘Complex tables’ is the wrong term to use in this instance.<br>It’s simply convoluted and poorly built. That’s it.<br>Band-aids are being applied over older band aids. Clearly, no one is reviewing the code base and ensuring it’s up to date, being applied correctly or even up to scratch standards wise.</p><p>I’m still not 100% clear on what the specific issue was. <br>All I know is that cleaning the HTML slightly, fixed it. No HTML errors were showing in the original file, so it doesn’t seem to be an invalid HTML issue. <br>It’s as if Outlook was itself overwhelmed by the sheer over complication of what should have been a simple build 😵</p><p><strong>Do better Uber.<br></strong>You have the money and resource to fix this.<br>We as a community would love if you reached out for help. <br>We’ll welcome you in, run you through what you need to work on and help with implementation.</p><p>We look forward to hearing from you ✌🏾</p><h3>🙋🏾 One final thing!</h3><p>This happened to be timed really well for a personal project I’m launching very soon. It’s called Bare Bones and will be a blog + newsletter to document HTML deep dives (such as this), tutorials and thoughts on email development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*f6R0COawx8ZH12Lfv54jsg.png" /><figcaption>The logo for my new project, Bare Bones.</figcaption></figure><p>I’ve wanted to mentor junior developers for some time now, however I can’t dedicate the time at the moment. So this is my way of indirectly mentoring and helping whomever I can, in my free time and around my more important life events.</p><p>I can’t give too much away yet as I’m deep in the build stages of the website &amp; blog. <br>However, you can <a href="https://www.getrevue.co/profile/Barebonesclub">get on the mailing list now</a> and then I can keep you posted on my progress.</p><p>📥 <a href="https://www.getrevue.co/profile/Barebonesclub"><strong>Sign up for the Bare Bones mailing list.</strong></a></p><p><a href="https://www.getrevue.co/profile/Barebonesclub">Bare Bones Club - Code tutorials, design teardowns &amp; thoughts on email development. - Revue</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2894d47d6d0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tesla Configurator & Battery Range Calculator— Interactive HTML Email Experiment]]></title>
            <link>https://nivenranchhod.medium.com/tesla-configurator-battery-range-calculator-interactive-html-email-experiment-c222145021ff?source=rss-8178353afb77------2</link>
            <guid isPermaLink="false">https://medium.com/p/c222145021ff</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[email-marketing]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[email]]></category>
            <dc:creator><![CDATA[Niven Ranchhod]]></dc:creator>
            <pubDate>Thu, 13 May 2021 14:32:58 GMT</pubDate>
            <atom:updated>2024-03-18T20:42:26.686Z</atom:updated>
            <content:encoded><![CDATA[<h4>My personal challenge to build a complex &amp; real world interactive email</h4><blockquote>Disclaimer: This project was in no way affiliated with Tesla</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4E0j1yzNzn9X7FMGIo1SA.png" /><figcaption>My version of the old Tesla Range Calculator in all of it’s glory</figcaption></figure><p><strong>🚗 </strong><a href="https://bare-bones.dev/code/tesla-car-configurator/"><strong>View the configurator &amp; range calculator</strong></a></p><h3>🎮 Functionality</h3><p>The interactive tool is made up of two parts:<br>1. Car configurator — Includes a slideshow of three different angles of the car, colour selection and wheel size &amp; design selection. <br>Both of the colour and wheel options will update the slideshow so you can preview your specific Model S.</p><p>2. Range calculator — Includes the three model options in the Model S family and their ‘calculated’ ranges with the three default settings (speed, outside temperature &amp; AC or Heat on/off).<br>The three settings will each have a determining factor on the range of each model option.</p><h3>💡 The idea</h3><p>The idea for this email was sparked at least four or five years ago after seeing the original range calculator on the Tesla website (now removed), being recreated in <a href="https://www.freecodecamp.org/news/building-teslas-battery-range-calculator-with-react-part-1-2cb7abd8c1ee/">React</a> &amp; <a href="https://ultimatecourses.com/blog/building-tesla-range-calculator-angular-2-reactive-forms#stats-component">Angular</a>.<br>The idea only included the battery range calculator at the time. The configurator was a later addition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVt3EGX2uKeabYU8qrGlqg.png" /><figcaption>The original look of the battery range calculator on the Tesla website.</figcaption></figure><p>It was really interesting to see how these developers went about recreating the tool in the chosen frameworks and it got me thinking… <br>How would this translate to email?</p><ol><li>We obviously can’t use a matrix of range values in JS like the JS framework examples are using.</li><li>How will the up/down arrows &amp; AC/Heat button change the three range values</li><li>Is there any way to connect the wheels to the current speed to add a little more interactivity and a differentiating factor to the JS examples. The original and rebuilds simply had the wheels rotating at one speed.</li></ol><p>Todd Motto, the creator of the Angular tutorial thankfully supplied all of the assets including the car, wheels with motion blur added, AC/Heat button and the Model S option logos.</p><p>So I went ahead and started the base build, laying out each section and leaving the nitty gritty testing for updating the range calculations for later.<br>Work was completed when I had some down time. <br>I was juggling a lot, at work and in my personal life so work on this was infrequent.</p><p>Fast forward a few months and we were planning our big move from New Zealand to the UK. Unfortunately this resulted in this build collecting digital dust while I got myself settled into Scottish life and a new job.</p><p>Fast forward three and a half years to early 2021 and while cleaning up my personal files I found this little gem.</p><h3>🔨 Build — Sourcing assets</h3><p>At the point of stopping work on this almost four years ago, I had tested out <a href="https://css-tricks.com/almanac/properties/c/counter-increment/">CSS counters</a> to control the range calculations. This was in an effort to avoid <a href="https://www.webdesignerdepot.com/2015/10/punched-card-coding-the-secret-of-interactive-email/">Punched Card Coding</a> (PCC) i.e. multiple inputs and labels being shown/hidden to display specific content. The larger and more complex the functionality, the more inputs and complex CSS selector chaining required.<br>In the end it just wasn’t the way to go and so I reverted to the trusted PCC method.</p><p>As well as blowing off the dust of this old project, Tesla had worked on an update to the Model S, introducing the 2021 Model S including cosmetic updates which were a massive issue for my build. My imagery, assets grabbed from Todd Motto’s tutorial and model options would be out of date.<br>Further to that, the design was pretty dated. Definitely time for a refresh!</p><p>So I scoured the internet for high-res imagery, even resorting to guessing URLs for images on the Tesla website. <br>It took a while but I ended up finding high-res images of all colour &amp; wheels variants of the new Model S, including an updated side profile &amp; wheels for the range calculator animation.</p><p>Thinking modern day email development, I also then needed to cut all of these out so I could optimise for dark mode.<br>Hours of cutting out and refining and I finally had some transparent PNGs to work with.</p><p>Now the cut outs aren’t that great because of the way the final images were exported, so I ended up heavily using the feather on the edges of all images. <br>I’m not completely happy with the dark mode view because of the white halo around the images, but ultimately I just need to remember if this were in fact a real world Tesla commissioned project, they would easily be able to provide me with clear cut transparent PNGs, so my half baked solution will suffice for now.</p><h3>🔨 Build — Design</h3><p>Right, first off — I am not a designer! I can scrape through with small design tweaks but I’m not that creative with layouts etc.<br>BUT, I’m really happy with the end result.</p><p>I did some <a href="https://dribbble.com/Nivicious/collections/4467563-email-inspo?utm_source=Clipboard_%22clipboard_collection%22&amp;utm_campaign=%22Nivicious%22&amp;utm_content=%22email%20inspo%22&amp;utm_medium=Social_Share">design research on Dribbble</a> and ended up amalgamating a few ideas to give me the configurator design.</p><p>Looks quite polished in light mode!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F13Y6LAZJqRspI4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F13Y6LAZJqRspI4%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="323" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2867b1158e4b5f5fb54341acf3ba74b/href">https://medium.com/media/d2867b1158e4b5f5fb54341acf3ba74b/href</a></iframe><h3>🔨 Build — Execution</h3><p><strong>Hero &amp; slideshow<br></strong>The hero section which includes the “MODEL S” title + slideshow are layered with the title being absolutely positioned. No faux absolute position setups here, just a simple CSS declaration on the title div.</p><p>The reason I didn’t go with the faux absolute position method (<a href="https://www.goodemailcode.com/email-enhancements/faux-absolute-position">Mark Robbins</a> / <a href="https://sayo1337.medium.com/overlay-email-absolute-positioning-efd2f2f09ed4">Steven Sayo</a>) is that this email will generally only really work with the methods included in Apple Mail (MacOS &amp; iOS) and Outlook Office 365 (MacOS) which all support absolute positioning and all of the other methods used in this email for that matter.</p><p>The slideshow is essentially like a <a href="https://codepen.io/anon/pen/WQwagL">tabbed section</a>.<br>Hide all main content areas (side and rear profile views) on load, apart from the default which in this case was the front angle image.<br>The thumbs are radio inputs, so only one can be selected at a time. <br>On click, a radio button is selected and the CSS selector will switch which larger preview is shown. Easy!</p><p><strong>Configurator<br></strong>This is where things get a little complicated.<br>I’ve now added a colour selector and a wheel size &amp; design selector.<br>Easy in functionality, again using radio inputs so only one can be a selected at a time but I’ve tied this into the slideshow which adds so much complexity into the CSS required to show/hide not only the correct colour but also the correct car angle depending on where the user stopped clicking through the thumbs. <br>On top of that, the thumbnails also update to reflect the colour and wheel options.</p><p>Oh, I didn’t mention this also ties into the battery range calculator car with the spinning wheels below the configurator.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl0MYPyvlf5JDEPUys%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl0MYPyvlf5JDEPUys%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fl0MYPyvlf5JDEPUys%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="299" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e7cd56d42b3a6d8c3a2dd531b7ae741/href">https://medium.com/media/9e7cd56d42b3a6d8c3a2dd531b7ae741/href</a></iframe><p>I’m not going to go into detail on how this all ties together as there is a whole lot to go through!<br>Feel free to view the <a href="https://nivenranchhod.github.io/portfolio/tesla-range-calculator/tesla-range-calc-styles.css">external stylesheet that holds all of the interactive CSS</a>.<br>It’s mega and complicated but it is essentially the brains of the operation.</p><p><strong>Battery Range Calculator</strong><br>By now you’re probably exhausted. So was I.<br>But we still have half of the build left to go.</p><p>My first task was to find out the different speed and outside temperature options included in the original tool.<br>Easy, I just copied what was included in the original tool.</p><p><strong>Speed range: </strong>45 / 50 / 55 (default) / 60 / 65 / 70</p><p><strong>Outside temperature range:</strong> -10 / 0 / 10 / 20 (default) / 30 / 40</p><p>Oh wait, there’s more. We also have an AC/Heat button which is enabled by default but also changes between AC when the outside temperature is above 10° and Heat when the outside temperature is below 20°</p><p>So for the speed and outside temperatures to work with the up/down arrows, I decided to go with the psuedo selector :before.<br>This way I’m not hiding/showing a div or and image to simply show a number.</p><p>For example — We increase the speed to 60, the corresponding CSS is:</p><pre>#speed-60-up:checked ~ .showroom .speed-counter:before { content: &#39;60&#39;; }</pre><p>Same for increasing the outside temperature to 30°:</p><pre>#temp-30-up:checked ~ .showroom .temp-counter:before { content: &#39;30&#39;; }</pre><p>Now for the AC/Heat button background image switch, if we’ve set an outside temperature of 20° or above:</p><pre>#temp-20-up:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-30-up:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-40-up:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-20-down:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-30-down:checked ~ #temp-control:checked ~ .showroom .temp-control-bg { background-image: url(https://medium.com/images/temp-control-ac.png)!important; }</pre><p>10° or below:</p><pre>#temp-10-up:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-0-up:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-10-down:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp-0-down:checked ~ #temp-control:checked ~ .showroom .temp-control-bg, <br>#temp--10-down:checked ~ #temp-control:checked ~ .showroom .temp-control-bg { background-image: url(https://medium.com/images/temp-control-heat.png)!important; }</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o7TKRwpns23QMNNiE%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o7TKRwpns23QMNNiE%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3o7TKRwpns23QMNNiE%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="299" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b55bbb2e8eb1e0343541066c72eab23/href">https://medium.com/media/8b55bbb2e8eb1e0343541066c72eab23/href</a></iframe><p>And finally I tied the wheel turning animation to the speed figure.<br>So now any time the speed is increased/decreased, the CSS animation will also increase/decrease. With the default 55mph:</p><pre>#speed-55-up:checked ~ .showroom .wheel, <br>#speed-55-down:checked ~ .showroom .wheel { -webkit-animation: infinite-spinning 80ms steps(4) infinite reverse!important; animation: infinite-spinning 80ms steps(4) infinite reverse!important; }</pre><p>Right that’s the settings panels out of the way. The values switch out as expected but now how do we tie those into the range values???</p><p>Again we can utilise our trusty pseudo selector :before, again.<br>However, the CSS chaining is waaaaay more complicated here.</p><ol><li>With the updated model, the range calculations would no doubt be different from the original Model S options. What are they and where do I get them?</li><li>Even if they were the same, would I have to go through every variation in the calculator to find out all of the figures.</li><li>Could I just make up some figures to save me time but also to avoid using old figures?</li></ol><p>I ended up doing some digging and found that the Angular tutorial had recorded all of this information for me in this <a href="https://github.com/ultimatecourses/angular-tesla-range-calculator/blob/master/src/app/tesla-battery/tesla-battery.service.ts">amazingly detailed file on Github</a>.<br>They had the ranges corresponding to the outside temperatures, grouped by speed, then by whether the AC/Heat was on/off, then by wheel size and then by model type.<br>I couldn’t even dream of being that detailed with my matrix, but it’s exactly what I needed.</p><p>The original Model S had a lot more model types: <br>60 / 60D / 75 / 75D / 90D / P100D.</p><p>Whereas the 2021 model only had (at the time of build): <br>Long Range / Plaid / Plaid+.</p><p>This reduced a lot of manual documentation. THANKFULLY!</p><p>But I still had a lot of work to set up the CSS selector chain to show the correct range value for each model.</p><p>Here is the CSS for a speed of 55mph, outside temp of 20°, AC on and the 19&quot; wheel option:</p><pre>Long Range:<br>#speed-55-down:checked ~ #temp-20-down:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-long-range:after, <br>#speed-55-down:checked ~ #temp-20-up:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-long-range:after, <br>#speed-55-up:checked ~ #temp-20-down:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-long-range:after, <br>#speed-55-up:checked ~ #temp-20-up:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-long-range:after { content: &#39;306&#39;; }</pre><pre>Plaid:<br>#speed-55-down:checked ~ #temp-20-down:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid:after, <br>#speed-55-down:checked ~ #temp-20-up:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid:after, <br>#speed-55-up:checked ~ #temp-20-down:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid:after, <br>#speed-55-up:checked ~ #temp-20-up:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid:after { content: &#39;336&#39;; }</pre><pre>Plaid+:<br>#speed-55-down:checked ~ #temp-20-down:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid-plus:after, <br>#speed-55-down:checked ~ #temp-20-up:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid-plus:after, <br>#speed-55-up:checked ~ #temp-20-down:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid-plus:after, <br>#speed-55-up:checked ~ #temp-20-up:checked ~ #temp-control:checked ~ #wheel-19:checked ~ .showroom .model-plaid-plus:after { content: &#39;376&#39;; }</pre><p>That is a fair amount of CSS to spit out one figure for each model.<br>Now imagine that for each variable for speed, outside temp and AC/Heat on/off. <br>An upside of this method of setup is the flexibility to amend those figures going forward, when using an external stylesheet.</p><h3>💀 Fallback</h3><p>This specific execution doesn’t have amazing support, as noted earlier on. It pretty much only works in Apple Mail (desktop &amp; mobile) &amp; Outlook Office 365 (MacOS). But it still shows what is possible.</p><h3>😭 Conclusion</h3><p>In an ideal world, the ‘Order now’ button would take your configuration and take you to the checkout page for the Model S.</p><p>Also you may wonder why this would be useful?<br>Imagine the Model S was released in allocation pools and this email were part of an automated journey and was fired out when a new allocation pool opened up. Customers who showed interest could choose their configuration, double check the mileage they would get with the model of choice and then hit ‘Order now’ and the system can take them through to checkout instantly.</p><p>I reckon that would make customers over the moon if that meant they could effectively jump the queue.</p><p><strong>Technical note</strong><br>Now by no means am I saying the methods I’ve used in this are ideal or the best way to do it. I’m already wondering if there is a cleaner way to select the numerous variables to spit out a result. <br>I mean, could I have used better CSS selectors to reduce some of the weight. Maybe.<br>Could I have built this with better support to allow more people to view the email, maybe.</p><p><strong>My next challenge</strong><br>I’ve already got my eye on the next challenge, which will be building the <a href="https://bare-bones.dev/code/mclaren-car-configurator/">McLaren car configurator</a> (now complete) using AMP.</p><p>I’m potentially getting in way over my head but I need to learn AMP, I want to build even more complex interactive emails and I’m always up for a challenge.<br>Wish me luck!</p><p>And feel free to reach out through the social or email links <a href="https://bare-bones.dev/">on my website</a>.</p><h3>Links</h3><p>🚗<strong> </strong><a href="https://nivenranchhod.github.io/portfolio/tesla-range-calculator/tesla-range-calc-2021.html"><strong>View the configurator &amp; range calculator</strong></a><strong><br>💻 </strong><a href="https://bare-bones.dev/"><strong>My website</strong></a><strong><br>⌨ </strong><a href="/service/mailto:hello@bare-bones.dev"><strong>Interested in learning more about this build or working together? Get in touch</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c222145021ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>