Fun with Fonts: Free HTML & CSS Tutorial
Master Custom Typography with Google Fonts Integration
What You'll Master in This Tutorial
Google Fonts Integration
Learn to embed custom web fonts from Google's extensive library into your HTML pages. Master the proper linking techniques for optimal performance.
Font Stack Strategy
Understand how to create safe fallback fonts that ensure your design remains consistent even when custom fonts fail to load.
Typography Optimization
Discover how to improve text legibility through proper line-height, margins, and spacing adjustments for professional results.
Tutorial Setup Process
Close Existing Files
Close any open files in your code editor to avoid confusion with multiple projects
Navigate to Exercise Folder
Open the Hipstirred Font Fun folder located in Desktop > Class Files > Web Dev Class
Load Project in Editor
Open the entire folder in your code editor like Visual Studio Code for easier file management
Setting max-width to 850px creates an ideal line length for readability. Lines that are too long strain the reader's eyes and reduce comprehension.
CSS Properties for Content Layout
max-width: 850px
Limits content width for optimal readability. Prevents text lines from becoming too long on wide screens.
margin: auto
Centers the content horizontally within its container. Works with left and right auto margins.
padding: 25px
Adds breathing room around content. Prevents text from touching browser edges on mobile devices.
Google Fonts Selection Process
Preview with Your Content
Type 'Curated Coffee' in the preview field to see how fonts will look with your actual text
Search Specific Fonts
Search for and select Medula One, Rancho, and Abel fonts to compare different typography styles
Choose Font Weights Carefully
Select only the font weights you'll actually use, as each style increases file size and load time
The rel='preconnect' lines tell the browser to connect to Google's font domains early, speeding up font downloads. The display=swap parameter ensures text remains visible during font loading.
Font Weight Understanding
| Feature | Weight Number | Description |
|---|---|---|
| 100-300 | Thin to Light | Very subtle, minimal |
| 400 | Normal/Regular | Default body text weight |
| 500-600 | Medium to Semi-bold | Subtle emphasis |
| 700+ | Bold to Black | Strong emphasis |
Unused fonts slow down page loading and waste mobile users' data. Always remove font families from your Google Fonts link when you stop using them in your CSS.
H2 Styling Techniques
Font Size Reduction
Setting font-size to 20px creates proper hierarchy. Subheadings should be smaller than main headings but larger than body text.
Text Transform
Using text-transform: uppercase gives subheadings a modern, professional appearance without changing HTML content.
Always test custom fonts on devices that don't have the fonts installed locally. Your computer might display fonts correctly even if the web embedding fails, masking potential issues.
Font Accessibility Considerations
Corporate Firewalls
Company networks often block external font services. Ensure your fallback fonts maintain design integrity when custom fonts fail.
Geographic Restrictions
Countries like China block Google services entirely. Your international users will see fallback fonts instead of your custom typography.
Design App Font Integration
| Feature | Application | Google Fonts Support |
|---|---|---|
| Figma | Automatic loading | Built-in Google Fonts access |
| Adobe XD | Manual installation | Download and install required |
| Sketch | Manual installation | Use FontBase for easier management |
Key Takeaways

button at the top right.