0
0
Tailwindmarkup~30 mins

Font family utilities in Tailwind - Mini Project: Build & Apply

Choose your learning style9 modes available
Font Family Utilities with Tailwind CSS
📖 Scenario: You are creating a simple webpage for a local bakery. The bakery wants to use different font styles for headings and paragraphs to make the text look friendly and easy to read.
🎯 Goal: Build a webpage using Tailwind CSS that applies different font families to the heading and paragraph text using Tailwind's font family utilities.
📋 What You'll Learn
Use Tailwind CSS font family utilities to style text
Apply a serif font family to the main heading
Apply a sans-serif font family to the paragraph
Use semantic HTML elements
Ensure the page is responsive and accessible
💡 Why This Matters
🌍 Real World
Websites often need different font styles to create a clear and attractive design. Using Tailwind's font family utilities makes it easy to apply consistent fonts without writing custom CSS.
💼 Career
Knowing how to use utility-first CSS frameworks like Tailwind is valuable for front-end developers to quickly style websites with clean, maintainable code.
Progress0 / 4 steps
1
Create the HTML structure
Create a basic HTML5 skeleton with a <header> containing an <h1> with the text "Welcome to Sweet Treats Bakery" and a <main> containing a <p> with the text "Freshly baked goods every day."
Tailwind
Need a hint?

Use semantic tags <header> and <main> with the exact text inside <h1> and <p>.

2
Add Tailwind CSS link
Add the Tailwind CSS CDN link inside the <head> section to enable Tailwind utilities on the page.
Tailwind
Need a hint?

Use the official Tailwind CSS CDN script tag inside <head>.

3
Apply font family utilities
Add the Tailwind class font-serif to the <h1> and the class font-sans to the <p> to apply serif font to the heading and sans-serif font to the paragraph.
Tailwind
Need a hint?

Use the exact Tailwind classes font-serif on the heading and font-sans on the paragraph.

4
Add accessibility and responsive design
Add an aria-label with the value "Bakery main heading" to the <h1> and add responsive padding classes p-4 sm:p-8 to the <main> for better spacing on small and larger screens.
Tailwind
Need a hint?

Use aria-label="Bakery main heading" on the <h1> and add p-4 sm:p-8 classes to the <main> tag.