Bird
Raised Fist0
Tailwindmarkup~20 mins

Font family utilities in Tailwind - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Font Family Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the rendered font family for this Tailwind class?
Given the HTML snippet below, what font family will the text use in a browser?

<p class="font-serif">Hello World</p>
Tailwind
<p class="font-serif">Hello World</p>
AThe text uses a monospace font family like Courier New.
BThe text uses a sans-serif font family like Arial or Helvetica.
CThe text uses a serif font family like Times New Roman or Georgia.
DThe text uses a cursive font family like Comic Sans.
Attempts:
2 left
💡 Hint
Tailwind's font-serif class applies a serif font stack.
🧠 Conceptual
intermediate
2:00remaining
Which Tailwind class applies a monospace font?
You want your code snippet text to look like typed code with fixed-width letters. Which Tailwind class should you use?
Afont-sans
Bfont-serif
Cfont-code
Dfont-mono
Attempts:
2 left
💡 Hint
Monospace fonts have equal width for all characters.
rendering
advanced
2:00remaining
What is the visual difference between font-sans and font-serif in Tailwind?
You have two paragraphs:

<p class="font-sans">Sans-serif text</p>
<p class="font-serif">Serif text</p>


How will these paragraphs look different in a browser?
Tailwind
<p class="font-sans">Sans-serif text</p>
<p class="font-serif">Serif text</p>
Afont-sans text has no small strokes at letter ends; font-serif text has small decorative strokes.
Bfont-sans text is italic; font-serif text is bold.
Cfont-sans text uses fixed-width letters; font-serif text uses variable-width letters.
Dfont-sans text is uppercase; font-serif text is lowercase.
Attempts:
2 left
💡 Hint
Serif fonts have small lines at the ends of letters; sans-serif fonts do not.
selector
advanced
2:00remaining
Which Tailwind class combination sets a monospace font with bold weight?
You want text that uses a monospace font and appears bold. Which class combination achieves this?
Afont-mono font-bold
Bfont-serif font-semibold
Cfont-sans font-light
Dfont-mono font-light
Attempts:
2 left
💡 Hint
font-mono sets monospace; font-bold sets bold weight.
accessibility
expert
2:00remaining
Why is choosing the right font family important for accessibility?
Which statement best explains why font family choice matters for users with reading difficulties?
ASerif fonts are always easier to read for everyone, so use font-serif everywhere.
BMonospace fonts improve readability for code but may reduce readability for long text.
CFont family choice does not affect accessibility; only font size matters.
DSans-serif fonts are never recommended because they cause eye strain.
Attempts:
2 left
💡 Hint
Think about different reading needs and contexts.

Practice

(1/5)
1. Which Tailwind CSS class applies a sans-serif font to text?
easy
A. font-bold
B. font-sans
C. font-mono
D. font-serif

Solution

  1. Step 1: Understand font family classes in Tailwind

    Tailwind provides font-sans for sans-serif fonts, font-serif for serif fonts, and font-mono for monospace fonts.
  2. Step 2: Identify the class for sans-serif

    The class font-sans applies a sans-serif font style to text.
  3. Final Answer:

    font-sans -> Option B
  4. Quick Check:

    Sans-serif font class = font-sans [OK]
Hint: Sans-serif font uses font-sans class in Tailwind [OK]
Common Mistakes:
  • Confusing font-serif with sans-serif
  • Using font-bold which controls weight, not font family
  • Choosing font-mono which is monospace, not sans-serif
2. Which of these is the correct Tailwind class to apply a monospace font?
easy
A. font-serif
B. font-sans
C. font-mono
D. font-light

Solution

  1. Step 1: Recall monospace font class in Tailwind

    Tailwind uses font-mono to apply monospace fonts, which have equal spacing for each character.
  2. Step 2: Confirm the correct class

    font-mono is the correct class to apply monospace fonts, while others apply serif, sans-serif, or font weight.
  3. Final Answer:

    font-mono -> Option C
  4. Quick Check:

    Monospace font class = font-mono [OK]
Hint: Monospace font always uses font-mono class [OK]
Common Mistakes:
  • Choosing font-serif or font-sans instead of font-mono
  • Confusing font-light (weight) with font family
  • Missing the monospace meaning of font-mono
3. What font family will the following HTML render with Tailwind?
<p class="font-serif">Hello World</p>
medium
A. Bold font
B. Monospace font
C. Sans-serif font
D. Serif font

Solution

  1. Step 1: Identify the class used in the paragraph

    The paragraph uses the class font-serif, which applies a serif font family.
  2. Step 2: Understand what serif font means

    Serif fonts have small decorative lines at the ends of letters, different from sans-serif or monospace fonts.
  3. Final Answer:

    Serif font -> Option D
  4. Quick Check:

    font-serif class = Serif font [OK]
Hint: font-serif class means serif font family [OK]
Common Mistakes:
  • Thinking font-serif applies sans-serif
  • Confusing font-serif with font-mono
  • Assuming font-bold changes font family
4. Find the error in this Tailwind usage:
<h1 class="font-sans-serif">Welcome</h1>
medium
A. font-sans-serif is not a valid Tailwind class
B. Missing quotes around class name
C. Should use font-mono for headings
D. Class name should be font-bold

Solution

  1. Step 1: Check the class name validity

    The class font-sans-serif is not a valid Tailwind font family class. Tailwind uses font-sans for sans-serif fonts.
  2. Step 2: Identify correct class for sans-serif

    The correct class to apply a sans-serif font is font-sans, not font-sans-serif.
  3. Final Answer:

    font-sans-serif is not a valid Tailwind class -> Option A
  4. Quick Check:

    Valid font family classes are font-sans, font-serif, font-mono [OK]
Hint: Tailwind font classes are font-sans, font-serif, font-mono only [OK]
Common Mistakes:
  • Adding extra words like '-serif' to font-sans
  • Confusing font weight classes with font family
  • Assuming font-mono is default for headings
5. You want to style a code block with a monospace font and make it easy to read on small screens. Which Tailwind classes should you use?
<code class="?">console.log('Hello')</code>
hard
A. font-mono text-sm
B. font-serif text-lg
C. font-sans text-xs
D. font-mono text-xl

Solution

  1. Step 1: Choose monospace font class for code

    Code blocks are best styled with monospace fonts, so use font-mono.
  2. Step 2: Select a small readable text size for small screens

    Use text-sm for smaller but readable text size on small devices.
  3. Final Answer:

    font-mono text-sm -> Option A
  4. Quick Check:

    Monospace + small text = font-mono text-sm [OK]
Hint: Use font-mono with text-sm for readable code on small screens [OK]
Common Mistakes:
  • Using font-serif or font-sans for code blocks
  • Choosing too large text size for small screens
  • Mixing font weight classes instead of font family