Font-Weight, Font-Style, & Unitless Line-Height
Master Typography with Custom Fonts and Modern CSS
Core Typography Concepts
Custom Web Fonts
Load and implement professional fonts from Google Fonts to enhance visual design and brand consistency.
Font Properties
Control font-weight and font-style to create visual hierarchy and emphasis in your content.
Unitless Line-Height
Use dynamic line spacing that scales proportionally with different font sizes for optimal readability.
This tutorial builds upon previous work with typography refinements, adding custom webfonts and improving line spacing for better readability.
Setup Process
Close Existing Files
Clear your workspace in the code editor to focus on the typography exercise files.
Open Project Folder
Navigate to Desktop > Class Files > Advanced HTML CSS Class and open the Tahoe Typography folder.
Launch Files
Open index.html in both your code editor and browser for live preview of changes.
Font Selection Strategy
Each font style increases download size and slows page loading. Only select styles you'll actually use in your design.
Font Implementation Process
Apply Base Font
Set Open Sans as the default font-family for the entire body element.
Style Headings
Create a combined h1, h2 rule to apply Alfa Slab One font to all heading levels.
Optimize Fallbacks
Replace cursive fallback with Open Sans and sans-serif for better font stack reliability.
Font Weight Values
| Feature | Keyword | Numeric |
|---|---|---|
| Normal | normal | 400 |
| Bold | bold | 700 |
| Light | light | 300 |
The h2 + p selector targets only the first paragraph immediately following an h2, perfect for styling taglines differently from body text.
Line-Height Approaches
| Feature | Fixed Units | Unitless |
|---|---|---|
| Inheritance | Static value | Dynamic calculation |
| Flexibility | Same for all elements | Scales with font-size |
| Example | 28px | 1.75 |
Line-Height Calculation Example
Typography Enhancement Checklist
Reduces page load time and improves performance
Ensures consistent spacing across different font sizes
Use 300 for light text, 400 for normal, 700 for bold emphasis
Ensure readability when custom fonts fail to load
Place Google Fonts links before other CSS for faster loading
Key Takeaways

button at the top right of the page.