Sub topic 7
Readable text and tappable targets on small screens
This chapter assumes you know basic HTML and CSS, the box model, and how media queries work. It also assumes you have read the earlier chapters on table layouts, inline CSS, and fluid and hybrid layouts. Here you will set type sizes, line heights, and spacing so text stays readable on a phone, and you will size links and buttons so a thumb can hit them.
Why small screens change the rules
A phone is held 30 to 40 cm from the eye and used with one thumb, often outdoors or while walking. Two problems follow from that:
- Text that looks fine on a desktop monitor becomes hard to read when the layout shrinks to 320 to 414 CSS pixels wide.
- A mouse pointer is precise. A fingertip covers roughly 7 to 10 mm, so small or tightly packed links cause mis-taps.
Email adds a third problem. Many clients rewrite or ignore parts of your CSS, so you can't assume that a rule you wrote will survive. The safest approach is to set sensible sizes inline, then use a media query to enlarge them where the client supports it.
Font sizes
Set body text to at least 16px. Many mobile clients, and iOS Mail in particular, may enlarge text they consider too small. That automatic enlargement can break a carefully balanced layout. Starting at 16px avoids it for most content.
A practical scale for a single-column template:
| Element | Desktop size | Mobile size | Line height |
|---|---|---|---|
| Body text | 16px | 16px | 24px |
| Heading (h1) | 28px | 24px to 28px | 32px to 36px |
| Subheading | 20px | 18px to 20px | 28px |
| Footer and legal text | 12px to 13px | 13px to 14px | 20px |
| Button label | 16px | 16px to 18px | 20px |
Use pixel values in email. Relative units such as rem have uneven support, and em compounds inside nested tables in ways that are hard to predict. Pixels behave the same across clients.
Avoid going below 12px for anything a reader needs, such as unsubscribe links and legal notices. Small text is also a common cause of accessibility complaints, and the unsubscribe link must be easy to find and use.
Line height and measure
Line height controls how easy it is to track from one line to the next. A value of 1.4 to 1.6 times the font size works well for body text. Specify it in pixels, for example font-size:16px;line-height:24px. Unitless line heights are inherited differently in some clients, and Outlook handles pixel values more predictably.
Measure is the length of a line of text. In a 600px container with 24px padding, a line holds about 550px of text. At 16px that is roughly 65 to 75 characters, a comfortable measure. On a phone, the line is much shorter, which is fine, but it means you should avoid long unbroken words and long URLs that force horizontal scrolling. Wrap long URLs in a link with readable text instead of printing them.
Font stacks and web fonts
Stick to a font stack that falls back to safe system fonts:
<td style="font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:24px;color:#222222;">
Your order has shipped and should arrive on Friday.
</td>Set font-family on each td that contains text, not only on the body. Some clients drop styles on body, and table cells in Outlook do not always inherit font settings from ancestors.
Web fonts load in a few clients, such as Apple Mail and iOS Mail, and are ignored elsewhere. If you use one, list it first and keep a system font after it. Check that the fallback has similar widths so the layout does not shift when the web font fails to load.
Padding instead of margins
Space text with padding on table cells. Margins on paragraphs and headings are handled inconsistently, and Outlook ignores margins on some elements. If you use p or h1 tags, reset their margins inline and place spacing on the surrounding td:
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding:24px 24px 8px 24px;font-family:Arial,Helvetica,sans-serif;">
<h1 style="margin:0;font-size:28px;line-height:34px;color:#222222;">Your order has shipped</h1>
</td>
</tr>
<tr>
<td style="padding:0 24px 24px 24px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:24px;color:#222222;">
<p style="margin:0;">Order 10482 left our warehouse today and should arrive on Friday.</p>
</td>
</tr>
</table>On a phone, 24px of side padding takes 48px from a 375px screen and leaves 327px for text. If that feels cramped, reduce the side padding to 16px in a media query.
Adjusting type in a media query
Where a client supports embedded styles, you can tune sizes for narrow screens. Inline values act as the default, so the media query needs !important to override them:
<style>
@media screen and (max-width: 600px) {
.h1 { font-size: 24px !important; line-height: 30px !important; }
.pad { padding-left: 16px !important; padding-right: 16px !important; }
.body-text { font-size: 17px !important; line-height: 26px !important; }
}
</style>Treat these rules as an enhancement. Gmail with a non-Google account (GANGA) and some other setups strip or ignore the style block, so the inline sizes must already work on their own.
Preventing automatic text resizing
Some mobile browsers apply their own text inflation. You can turn it off with:
<style>
body, table, td, a { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
</style>This keeps the sizes you chose. It does not replace choosing a sensible minimum size. If you disable adjustment and your text is 11px, readers get 11px.
Auto-linked text on iOS
iOS Mail turns phone numbers, dates, and addresses into blue links. That can clash with your design and may reduce contrast. You can control it two ways:
- Wrap the value in your own
atag with the color and style you want. - Add a rule that neutralizes the generated link:
<style>
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
</style>Only neutralize detected links when the styling would otherwise hurt the design. A tappable phone number is useful to readers.
Touch targets
A touch target is the area that responds when someone taps. Guidance varies by platform:
- Apple's Human Interface Guidelines suggest at least 44 by 44 points.
- Google's Material Design suggests at least 48 by 48 dp.
- WCAG 2.2 sets a minimum of 24 by 24 CSS pixels (success criterion 2.5.8) and 44 by 44 for the stricter level (2.5.5).
Aim for 44px in height as a practical floor, and 48px where space allows. Also leave at least 8px between adjacent targets so a tap on one does not hit the other.
Making a link tall enough
A text link is only as tall as its line. To enlarge the target, use padding on an inline-block link:
<a href="https://example.com/orders" style="display:inline-block;padding:12px 8px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:20px;color:#0b5fff;text-decoration:underline;">Track your package</a>With 12px of padding above and below a 20px line, the link is 44px tall. Outlook for Windows does not honor vertical padding on inline elements, so for primary actions use the table-cell button from the earlier button chapter. Reserve padded links for secondary navigation.
Stacking footer and navigation links
Rows of small links separated by pipes are a common failure on phones. Stack them in separate cells or rows on narrow screens:
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="stack" width="33%" align="center" style="padding:4px;">
<a href="https://example.com/shop" style="display:inline-block;padding:12px 8px;font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;color:#0b5fff;">Shop</a>
</td>
<td class="stack" width="33%" align="center" style="padding:4px;">
<a href="https://example.com/help" style="display:inline-block;padding:12px 8px;font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;color:#0b5fff;">Help</a>
</td>
<td class="stack" width="33%" align="center" style="padding:4px;">
<a href="https://example.com/account" style="display:inline-block;padding:12px 8px;font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;color:#0b5fff;">Account</a>
</td>
</tr>
</table>If the stack class is supported (see the media queries chapter), these links become full-width rows. If not, they still sit in three cells that are each wide enough to tap.
Contrast and color
Readable text depends on contrast as much as size. WCAG asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18px bold or 24px regular and above). Light gray text on white, such as #999999 on #ffffff, is about 2.8:1 and fails. #595959 on white is about 7:1 and passes.
Phones are used in bright light, which makes weak contrast worse. Choose dark text on a light background by default, and check contrast again for your dark mode colors.
Putting the decisions in order
The order matters. Every step before the last must work with no embedded CSS, because the last step may never run.
Common errors
- Text under 14px for body copy. It is hard to read and may trigger client resizing. Use 16px.
- Unitless or percentage line heights. Outlook and some other clients treat them inconsistently. Use pixels.
- Fonts set only on
body. Set them on each text cell. - Margins for spacing. Use padding on cells.
- Links with no padding. A one-line text link is about 20px tall, well under the target size.
- Targets placed too close together. Leave at least 8px between them.
- Relying on the style block alone. Put working sizes inline first.
- Low-contrast gray text. Test your colors against the 4.5:1 ratio.
Quick check before moving on
Exercise
A footer link is set as <a href="..." style="font-size:13px;color:#999999;">Unsubscribe</a> on a white background inside a table cell with no padding. List three problems with it for phone readers and give a corrected version.
Show answer
The problems are: (1) the contrast of #999999 on white is about 2.8:1, below the 4.5:1 minimum; (2) 13px is small and the link is only about one line tall, well under a 44px target; (3) there is no font-family or line-height set inline, so it depends on inheritance that some clients drop. A corrected version is: <a href="..." style="display:inline-block;padding:12px 8px;font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;color:#595959;text-decoration:underline;">Unsubscribe</a>. It has a contrast ratio of about 7:1, a height of 44px (20px line plus 24px padding), and explicit font settings.
Exercise
Why do email templates give line height in pixels and put !important on the values inside a mobile media query?
Show answer
Pixel line heights behave consistently across clients, including Outlook, while unitless values can be inherited differently. The !important is needed because the original sizes are written inline, and inline styles beat any rule in a style block unless the block rule is marked !important.