Which CSS property is used to align text horizontally?
Analysis & Theory
`text-align` is used to align text horizontally within its containing element.
What does `text-align: center;` do?
A
Aligns text to the left
B
Aligns text to the right
C
Aligns text to the center of its container
Analysis & Theory
`text-align: center;` centers the text within the parent element.
Which of the following values are valid for `text-align`?
Analysis & Theory
`text-align` can be set to `left`, `right`, `center`, `justify`, and more depending on context.
What does `text-align: justify;` do?
A
Aligns text to the left and right by adjusting spacing
C
Aligns text to the left only
D
Adds margin around text
Analysis & Theory
`justify` spreads text so both the left and right edges align evenly.
Which `text-align` value aligns text to the right?
Analysis & Theory
`text-align: right;` aligns the text to the right side of the container.
What is the default value of `text-align` for most block elements?
Analysis & Theory
The default value of `text-align` is `left` for left-to-right languages.
Can `text-align` be applied to inline elements?
B
No, only block elements
Analysis & Theory
`text-align` affects the content inside a block-level element, including inline children.
How do you center text inside a `<div>`?
A
div { text-align: center; }
D
div { font-align: center; }
Analysis & Theory
`text-align: center;` correctly centers the text within a `<div>`.
Does `text-align` affect vertical alignment?
A
Yes, it affects both vertical and horizontal alignment
B
No, it only affects horizontal alignment
D
Only for inline elements
Analysis & Theory
`text-align` only controls horizontal text alignment.
Which value of `text-align` is best for newspaper-style column text?
Analysis & Theory
`justify` is used to make text align evenly along both left and right edges, ideal for column layouts.