-
Notifications
You must be signed in to change notification settings - Fork 1
Typography
Zak edited this page Apr 3, 2020
·
5 revisions
Typography (or text, fonts, etc) is used to display the most common type of content on the web. It has a direct impact on the user's experience and the accessibility of a website. Typography should provide a high degree of accessibility by default with little-to-no thought by the developer in a wide variety of applications including, but not limited to:
- light & dark themes
- long & short-form content
Typography is hard. Having an accessible-by-default solution to text content in a webapp is a critical factor in the overall viability of a component library.
- Typography automatically applies correct color from theme to maintain contrast ratios
- Size and Style are independent of semantic tag
- Margin Collapse is supported to provide accessible spacing with both short and long-form text
- Requires
display: blockordisplay: inline-blockon wrapping container. Should probably be addressed when we build out a Spacing System
- Requires
-
Best Practices (WebAIM Guidance)
- Use real text rather than text within graphics.
- Select basic, simple, easily-readable fonts.
- Use a limited number of fonts.
- Ensure sufficient contrast between the text and the background.
- Avoid small font sizes.
- Use relative units for font size.
- Limit the use of font variations such as bold, italics, and ALL CAPITAL LETTERS.
- Don't rely only on the appearance of the font (color, shape, font variation, placement, etc.) to convey meaning.
- Avoid blinking or moving text.
-
Practical Requirements
- Prefer System Fonts, fall back to Web Fonts (e.g. Google Fonts)
- Prefer fonts designed specifically for digital devices
- Use semantic tags with intent, e.g. vs
- Text should have a minimum contrast ratio of 4.5:1
- Large text (24p or larger) may have 3:1 ratio (prefer 4.5 though!)
- Font Size should be defined using relative sizes (i.e. use
remorem) - Line Height for longform text should range between 1.3 & 1.7
- 5 Tips for Web Typography
- Fluid Typography - This is super cool!
- Google Fonts Getting Started article