Bird
Raised Fist0
Tailwindmarkup~20 mins

Text decoration and underline 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
🎖️
Text Decoration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the effect of this Tailwind class?
Consider the following HTML snippet:
<p class="underline decoration-red-500">Hello World</p>

What will the text look like in the browser?
Tailwind
<p class="underline decoration-red-500">Hello World</p>
AThe text is underlined with a red line.
BThe text is underlined with a default black line.
CThe text is not underlined but colored red.
DThe text is bold and underlined.
Attempts:
2 left
💡 Hint
The 'underline' class adds an underline, and 'decoration-red-500' changes the underline color.
🧠 Conceptual
intermediate
1:30remaining
Which Tailwind class removes underline from a link?
You have a link styled with an underline by default. Which Tailwind class will remove the underline?
Tailwind
<a href="#" class="?">Click me</a>
Atext-no-underline
Bunderline-none
Cdecoration-none
Dno-underline
Attempts:
2 left
💡 Hint
Tailwind uses 'no-underline' to remove underlines.
rendering
advanced
2:00remaining
What is the visual difference between these two classes?
Look at these two Tailwind classes:
underline decoration-dotted
and
underline decoration-double

What difference will you see in the underline style?
ABoth show a solid underline with different thickness.
BThe first shows no underline, the second shows a dashed underline.
CThe first shows a dotted underline, the second shows a double line underline.
DBoth show a single solid underline but different colors.
Attempts:
2 left
💡 Hint
The 'decoration-' prefix controls the underline style.
selector
advanced
2:30remaining
Which Tailwind class combination creates a thick, wavy underline?
You want to style text with an underline that is thick and wavy. Which combination of Tailwind classes achieves this?
Aunderline decoration-double decoration-2
Bunderline decoration-wavy decoration-4
Cunderline decoration-solid decoration-8
Dunderline decoration-dotted decoration-1
Attempts:
2 left
💡 Hint
'decoration-wavy' sets the underline style, 'decoration-4' sets thickness.
accessibility
expert
3:00remaining
How to ensure underlined text is accessible for colorblind users?
You use Tailwind to underline important text with a colored underline. What is the best practice to ensure accessibility for colorblind users?
AUse underline with a color that has strong contrast and add an additional visual cue like bold or italics.
BOnly rely on underline color to convey meaning without other styles.
CRemove underline and use color alone to indicate importance.
DUse underline with a very light color to keep it subtle.
Attempts:
2 left
💡 Hint
Accessibility means not relying on color alone to convey information.

Practice

(1/5)
1. Which Tailwind CSS class adds an underline to text?
easy
A. line-through
B. no-underline
C. underline
D. text-underline

Solution

  1. Step 1: Understand the purpose of each class

    The underline class adds an underline to text, while line-through crosses out text, no-underline removes underline, and text-underline is not a valid Tailwind class.
  2. Step 2: Match the class to the underline effect

    Since the question asks for adding underline, underline is the correct class.
  3. Final Answer:

    underline -> Option C
  4. Quick Check:

    Underline class = underline [OK]
Hint: Underline text with class 'underline' in Tailwind [OK]
Common Mistakes:
  • Confusing underline with line-through
  • Using no-underline to add underline
  • Assuming text-underline exists
2. Which of these is the correct Tailwind class to remove underline from a link?
easy
A. no-underline
B. line-through
C. underline
D. text-no-underline

Solution

  1. Step 1: Identify the class that removes underline

    The class no-underline removes underline decoration from text.
  2. Step 2: Verify other options

    underline adds underline, line-through crosses out text, and text-no-underline is not a valid Tailwind class.
  3. Final Answer:

    no-underline -> Option A
  4. Quick Check:

    Remove underline = no-underline [OK]
Hint: Use 'no-underline' to remove underlines in Tailwind [OK]
Common Mistakes:
  • Using underline to remove underline
  • Assuming text-no-underline exists
  • Confusing line-through with no-underline
3. What will be the visual effect of this HTML snippet?
<p class="underline line-through text-red-500">Hello</p>
medium
A. Text has no decoration but is red
B. Text is only underlined in red color
C. Text is only crossed out in red color
D. Text is underlined and crossed out in red color

Solution

  1. Step 1: Analyze the classes applied

    The classes underline and line-through add underline and line-through decorations respectively. text-red-500 colors the text red.
  2. Step 2: Understand combined text decorations

    Both underline and line-through appear simultaneously, so the text will be underlined and crossed out in red color.
  3. Final Answer:

    Text is underlined and crossed out in red color -> Option D
  4. Quick Check:

    underline + line-through + red text = underlined & crossed out red text [OK]
Hint: Multiple decorations combine visually in Tailwind [OK]
Common Mistakes:
  • Thinking only one decoration applies
  • Ignoring color class effect
  • Assuming decorations override each other
4. Identify the error in this Tailwind usage:
<span class="underline text-underline-red">Sample</span>
medium
A. text-underline-red is not a valid Tailwind class
B. underline class is misspelled
C. Missing no-underline to remove underline
D. Underline cannot be used on span

Solution

  1. Step 1: Check validity of classes

    underline is valid and adds underline. text-underline-red is not a valid Tailwind class for underline color.
  2. Step 2: Understand how to color underline

    Tailwind uses decoration-red-500 or similar for underline color, not text-underline-red.
  3. Final Answer:

    text-underline-red is not a valid Tailwind class -> Option A
  4. Quick Check:

    Invalid class name = text-underline-red [OK]
Hint: Use 'decoration-color' classes for underline color [OK]
Common Mistakes:
  • Using text-underline-red instead of decoration-red-500
  • Assuming underline color uses text- prefix
  • Thinking underline can't be on span
5. You want to create a paragraph with a green underline but no line-through. Which Tailwind classes should you use?
hard
A. underline decoration-green-600 no-line-through
B. underline decoration-green-600
C. underline text-green-600 line-through
D. underline decoration-green-600 line-through

Solution

  1. Step 1: Choose classes for underline and color

    underline adds underline, and decoration-green-600 colors the underline green.
  2. Step 2: Avoid line-through classes

    Since no line-through is wanted, do not add line-through or any similar class. There is no no-line-through class in Tailwind.
  3. Final Answer:

    underline decoration-green-600 -> Option B
  4. Quick Check:

    Underline + green decoration, no line-through [OK]
Hint: Use 'underline' + 'decoration-color' for colored underline [OK]
Common Mistakes:
  • Adding non-existent no-line-through class
  • Using text-green-600 colors text, not underline
  • Including line-through by mistake