Challenge - 5 Problems
Text Alignment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What is the visual alignment of this text?
Given the following HTML snippet styled with Tailwind CSS, how will the text inside the
tag be aligned when viewed in a browser?
Tailwind
<div class="w-64 border border-gray-400"> <p class="text-right">Hello, world!</p> </div>
Attempts:
2 left
💡 Hint
Look at the Tailwind class that controls horizontal text alignment.
✗ Incorrect
The class text-right in Tailwind CSS aligns text to the right side of its container.
❓ selector
intermediate1:30remaining
Which Tailwind class centers text horizontally?
You want to center text horizontally inside a div using Tailwind CSS. Which class should you use?
Attempts:
2 left
💡 Hint
Think about the class name that suggests centering text.
✗ Incorrect
The text-center class centers text horizontally in Tailwind CSS.
🧠 Conceptual
advanced2:00remaining
What happens if you combine
text-left and text-center classes?Consider this HTML snippet:
How will the text be aligned in the browser?
<p class="text-left text-center">Sample Text</p>
How will the text be aligned in the browser?
Tailwind
<p class="text-left text-center">Sample Text</p>Attempts:
2 left
💡 Hint
In CSS, later classes override earlier ones if they affect the same property.
✗ Incorrect
When multiple classes affect the same CSS property, the last one in the class attribute usually takes precedence. Here, text-center overrides text-left.
❓ accessibility
advanced1:30remaining
Which text alignment is best for accessibility and readability?
For long paragraphs of text on a website, which alignment choice is generally considered best for readability and accessibility?
Attempts:
2 left
💡 Hint
Think about how easy it is to follow lines of text.
✗ Incorrect
Left-aligned text creates a consistent starting point for each line, making it easier to read and follow, especially for languages read left to right.
📝 Syntax
expert1:30remaining
What error occurs with this Tailwind class usage?
Examine this HTML snippet:
What will happen when this code is rendered in a browser?
<p class="text-centre">Hello</p>
What will happen when this code is rendered in a browser?
Tailwind
<p class="text-centre">Hello</p>Attempts:
2 left
💡 Hint
Check the spelling of the Tailwind class.
✗ Incorrect
The class text-centre is misspelled. Tailwind does not recognize it, so the browser ignores it and uses the default alignment, which is left-aligned.