0
0
Tailwindmarkup~20 mins

Custom font integration in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Custom Font Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
How to correctly add a custom font in Tailwind CSS config?
You want to add a custom font named 'Lobster' to your Tailwind CSS project. Which option correctly extends the fontFamily in tailwind.config.js?
Amodule.exports = { fontFamily: { lobster: ['Lobster', 'cursive'] } }
Bmodule.exports = { theme: { fontFamily: { lobster: ['Lobster', 'cursive'] } } }
Cmodule.exports = { extend: { fontFamily: { lobster: ['Lobster', 'cursive'] } } }
Dmodule.exports = { theme: { extend: { fontFamily: { lobster: ['Lobster', 'cursive'] } } } }
Attempts:
2 left
💡 Hint
Remember to use extend inside theme to add custom fonts without overwriting defaults.
rendering
intermediate
2:00remaining
What will be the font style of this element?
Given this HTML and Tailwind CSS setup, what font will the text inside the <p> use?

tailwind.config.js includes:
fontFamily: { lobster: ['Lobster', 'cursive'] }

HTML:
<p class="font-lobster">Hello World</p>
Tailwind
<p class="font-lobster">Hello World</p>
AThe text uses the 'Lobster' font if loaded, else falls back to cursive.
BThe text uses the default sans-serif font.
CThe text uses the browser default serif font.
DThe text will not display because 'font-lobster' is not a valid Tailwind class.
Attempts:
2 left
💡 Hint
Check if the custom font class matches the config name.
selector
advanced
2:00remaining
Which CSS selector applies the custom font only to headings inside
?
You want to apply your custom font class font-lobster only to all <h1> and <h2> inside the <main> element. Which CSS selector is correct?
Amain > h1.font-lobster, main > h2.font-lobster
Bmain h1.font-lobster, main h2.font-lobster
Cmain h1, main h2 { @apply font-lobster; }
Dh1.font-lobster, h2.font-lobster
Attempts:
2 left
💡 Hint
Think about selecting headings inside main that have the font class.
layout
advanced
2:00remaining
How to center text with custom font responsively?
You want to center a paragraph with class font-lobster horizontally on small screens and align left on medium and larger screens using Tailwind CSS. Which class combination achieves this?
Tailwind
<p class="font-lobster ???">Welcome!</p>
Atext-center md:text-left
Btext-left md:text-center
Ctext-center text-left md:text-left
Dmd:text-center text-left
Attempts:
2 left
💡 Hint
Remember Tailwind applies mobile-first styles, so base applies to small screens.
accessibility
expert
3:00remaining
Ensuring accessible custom font usage
You use a decorative custom font 'Lobster' for headings with class font-lobster. What is the best practice to keep your site accessible?
AUse the custom font with very small font size to avoid readability issues.
BApply the custom font to all body text to keep consistency.
CUse the custom font only for decorative headings and provide a readable fallback font.
DDisable screen readers on elements using the custom font to prevent confusion.
Attempts:
2 left
💡 Hint
Think about readability and assistive technology users.