Challenge - 5 Problems
Text Alignment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding text alignment behavior
What will be the horizontal alignment of the text inside this <div> if the CSS rule
text-align: justify; is applied?CSS
<div style="width: 300px; border: 1px solid black; text-align: justify;">This is a sample paragraph to test text alignment behavior.</div>Attempts:
2 left
💡 Hint
Justify alignment spreads text evenly across the line width.
✗ Incorrect
The
text-align: justify; style makes the text stretch so that each line (except the last) touches both left and right edges of the container, creating a clean block look.📝 Syntax
intermediate1:30remaining
Correct CSS property for right text alignment
Which CSS rule correctly aligns text to the right inside a paragraph?
CSS
<p>Align me right</p>
Attempts:
2 left
💡 Hint
The correct CSS property starts with 'text-align'.
✗ Incorrect
The valid CSS property to align text horizontally is
text-align. Other options are invalid CSS properties and will not work.❓ rendering
advanced2:30remaining
Visual result of mixed text alignment
Given the following HTML and CSS, what will the text alignment be for the <span> inside the <div>?
CSS
<style>
div { text-align: center; }
span { text-align: left; display: inline-block; width: 100%; }
</style>
<div>This is a <span>test</span> text.</div>Attempts:
2 left
💡 Hint
Inline-block elements can have their own text alignment.
✗ Incorrect
The <div> centers its text, but the <span> is inline-block with 100% width and text-align left, so its text aligns left inside the centered container.
❓ selector
advanced2:00remaining
CSS selector specificity for text alignment
Which CSS rule will override the others to align text to the right for all paragraphs inside a section with class 'content'?
Attempts:
2 left
💡 Hint
The !important rule overrides normal specificity.
✗ Incorrect
The
!important declaration forces the style to apply regardless of selector specificity, so option A will override all others.❓ accessibility
expert3:00remaining
Ensuring accessible text alignment for screen readers
Which practice helps maintain accessibility when using CSS text alignment for paragraphs?
Attempts:
2 left
💡 Hint
Screen readers read content in source order, not visual alignment.
✗ Incorrect
Text alignment affects only visual layout. To keep content accessible, do not change the reading order or hide text. Semantic HTML and proper structure are key.