Module 4 of 6 in the KINETIC.email developer course. Create interactive tab interfaces in your emails to organize content and improve the reader's experience.
Tabbed interfaces are one of the most practical applications of the checkbox hack. They let recipients switch between content sections without scrolling, so you can include more content without a lengthy email and readers can focus on what interests them.
Tabs save vertical space, organize content, encourage engagement through interaction and can be used to track preferences. They only work in supporting clients, require a fallback for everyone else, need careful CSS selectors, and can increase overall email size.
<input type="radio" id="tab1" name="tabs" checked>
<input type="radio" id="tab2" name="tabs">
<div class="tabs">
<label for="tab1">Tab 1</label>
<label for="tab2">Tab 2</label>
</div>
<div class="content">
<div id="content1" class="tab-content">...</div>
<div id="content2" class="tab-content">...</div>
</div>
.tab-content {
max-height: 0;
opacity: 0;
overflow: hidden;
}
#tab1:checked ~ .tabs label[for="tab1"] {
background: #003366;
color: white;
}
#tab1:checked ~* #content1 {
max-height: 500px !important;
opacity: 1 !important;
overflow: visible !important;
}
name means only one tab can be selected.#tab1:checked ~* #content1 reveals the matching panel; ~* targets the elements after the radio button.checked attribute on the first radio makes content visible when the email opens.The radios are hidden accessibly with position: absolute; opacity: 0;, and !important keeps the styles from being overridden by the email client.
Group the radios with name="tabs", check the first one, hide every .panel with max-height: 0, opacity: 0 and overflow: hidden, then add :checked rules that reveal the right panel.
Tab labels run out of space on small screens. The lesson shows two techniques. First, shrink the labels with a media query:
@media (max-width: 480px) {
.tab { padding: 8px 12px; font-size: 11px; }
}
Second, swap text for icons: each label holds an icon span and a text span, the icon is hidden by default, and on mobile the icon shows while the text hides.
.tab .icon { display: none; }
@media (max-width: 480px) {
.tab .icon { display: inline; }
.tab .text { display: none; }
}
Wrap the working tabs in the kinetic lightswitch from Module 3. Add a <label for="Kinetic"> reading "Toggle Lightswitch" to preview both versions, show .interactive with #Kinetic:checked ~ .interactive, and hide .fallback with #Kinetic:checked ~ .fallback.
checked attribute.Forgetting fallback content, overly complex tab structures, leaving out !important on display properties, using too many tabs, unclear labels, and not checking tab content height, which causes layout jumps when switching tabs. For deeper insight, place unique tracking pixels or links in each tab to see which content resonates.
Signing in lets you track your progress and earn course completion credits.
Previous: The Kinetic Lightswitch. Next: Engagement Quiz. Back to the learning hub.