Overview
Our typography system uses CSS custom properties (CSS variables) to provide consistent, accessible, and maintainable typography across the entire application.
The system is responsive and scales appropriately across different breakpoints. All typography values use semantic naming conventions for easy understanding and maintenance.
Use semantic HTML elements (<h1> through <h6>,
<p>, <small>)
to automatically apply the correct typography styles. You can also use CSS custom properties
directly in your components for custom typography needs.
Headings
All heading levels from h1 to h6 with their respective font sizes and line heights.
Heading 1
<h1>
- Font Size:
- 1.625rem
- Line Height:
- 2rem
Heading 2
<h2>
- Font Size:
- 1.25rem
- Line Height:
- 1.5rem
Heading 3
<h3>
- Font Size:
- 1.25rem
- Line Height:
- 1.75rem
Heading 4
<h4>
- Font Size:
- 1.125rem
- Line Height:
- 1.625rem
Heading 5
<h5>
- Font Size:
- 1rem
- Line Height:
- 1.5rem
Heading 6
<h6>
- Font Size:
- 0.875rem
- Line Height:
- 1.25rem
Responsive: At tablet landscape breakpoint (1024px and above), h1-h4 sizes increase for better readability on larger screens.
Body Text
Standard paragraph and body text styles.
This is a paragraph of body text. It demonstrates the default paragraph styling with appropriate font size and line height for optimal readability. The text flows naturally and provides a comfortable reading experience.
<p>
- Font Size:
- 1rem
- Line Height:
- 1.5rem
Paragraph with a link inside. Links inherit the font size and line height from their parent paragraph.
<p> <a>
- Font Size:
- inherit
- Line Height:
- inherit
<small>
- Font Size:
- 0.875rem
- Line Height:
- 1.25rem
Text Semantics
Additional text formatting elements.
This paragraph contains bold text and italic text for emphasis.
<strong>, <em>
- Font Weight:
- bold (700)
- Font Style:
- italic
Usage
Use semantic HTML elements to automatically apply typography styles. The system will automatically use the correct font sizes and line heights:
<h1>Main Page Title</h1>
<h2>Section Heading</h2>
<p>This is a paragraph of body text with <a href="#">a link</a> inside.</p>
<small>This is small text for disclaimers.</small>
You can also use CSS custom properties directly in your components for custom typography needs:
Using CSS Custom Properties
For custom components that need typography styles, use the CSS custom properties directly:
.my-custom-heading {
font-size: var(--font-size-h1);
line-height: var(--line-height-h1);
}
.my-custom-text {
font-size: var(--font-size-p);
line-height: var(--line-height-p);
}
The mapping between semantic elements and CSS custom properties is:
| Element | Font size variable | Line height variable |
|---|---|---|
h1 |
--font-size-h1 |
--line-height-h1 |
h2 |
--font-size-h2 |
--line-height-h2 |
h3 |
--font-size-h3 |
--line-height-h3 |
h4 |
--font-size-h4 |
--line-height-h4 |
h5 |
--font-size-h5 |
--line-height-h5 |
h6 |
--font-size-h6 |
--line-height-h6 |
p |
--font-size-p |
--line-height-p |
small |
--font-size-small |
--line-height-small |
CSS Custom Properties
All typography values are defined as CSS custom properties, making them easy to override and theme:
:root {
/* Headings */
--font-size-h1: 1.625rem;
--line-height-h1: 2rem;
--font-size-h2: 1.25rem;
--line-height-h2: 1.5rem;
--font-size-h3: 1.25rem;
--line-height-h3: 1.75rem;
--font-size-h4: 1.125rem;
--line-height-h4: 1.625rem;
--font-size-h5: 1rem;
--line-height-h5: 1.5rem;
--font-size-h6: 0.875rem;
--line-height-h6: 1.25rem;
/* Body text */
--font-size-p: 1rem;
--line-height-p: 1.5rem;
--font-size-small: 0.875rem;
--line-height-small: 1.25rem;
}
@media (min-width: 1024px) {
:root {
/* Responsive overrides for larger screens */
--font-size-h1: 2rem;
--line-height-h1: 2.5rem;
--font-size-h2: 1.625rem;
--line-height-h2: 2rem;
--font-size-h3: 1.5rem;
--line-height-h3: 2rem;
--font-size-h4: 1.25rem;
--line-height-h4: 1.75rem;
}
}
Note: You can override these CSS variables in your own stylesheets or themes to customize typography without modifying the base system.
Responsive Behavior
The typography system automatically scales at the tablet landscape breakpoint (1024px):
| Element | Mobile/Default | Tablet Landscape+ (1024px+) |
|---|---|---|
h1 |
1.625rem (26px) / 2rem (32px) | 2rem (32px) / 2.5rem (40px) |
h2 |
1.25rem (20px) / 1.5rem (24px) | 1.625rem (26px) / 2rem (32px) |
h3 |
1.25rem (20px) / 1.75rem (28px) | 1.5rem (24px) / 2rem (32px) |
h4 |
1.125rem (18px) / 1.625rem (26px) | 1.25rem (20px) / 1.75rem (28px) |
h5 |
1rem (16px) / 1.5rem (24px) | 1rem (16px) / 1.5rem (24px) |
h6 |
0.875rem (14px) / 1.25rem (20px) | 0.875rem (14px) / 1.25rem (20px) |
p |
1rem (16px) / 1.5rem (24px) | 1rem (16px) / 1.5rem (24px) |
small |
0.875rem (14px) / 1.25rem (20px) | 0.875rem (14px) / 1.25rem (20px) |
Format: font-size / line-height. Pixel values in parentheses approximate a 16px
base font size.