nerdexam
CIW

1D0-61B · Question #47

Which HTML element aligns content both horizontally and vertically to the center of the table cell by default?

The correct answer is C. <th>. <th> (table header) is the only table cell element that browsers render with both horizontal centering (text-align: center) and vertical centering (vertical-align: middle) applied by default, along with bold text. <td> is the most tempting distractor - it does vertically center…

HTML5 Coding

Question

Which HTML element aligns content both horizontally and vertically to the center of the table cell by default?

Options

  • A<tr>
  • B<td>
  • C<th>
  • D<pre>

How the community answered

(37 responses)
  • A
    5% (2)
  • B
    3% (1)
  • C
    89% (33)
  • D
    3% (1)

Explanation

<th> (table header) is the only table cell element that browsers render with both horizontal centering (text-align: center) and vertical centering (vertical-align: middle) applied by default, along with bold text. <td> is the most tempting distractor - it does vertically center content by default, but its horizontal alignment defaults to left, not center. <tr> defines a table row rather than a cell, so it holds no direct content and has no centering behavior. <pre> is entirely unrelated to tables - it preserves whitespace and uses a monospace font. Memory tip: Think "H for Header = Horizontally centered" - the <th> element is the headline of its column, so browsers emphasize it with bold + full centering by default, unlike the plain <td>.

Topics

#HTML tables#th element#text alignment#default styling

Community Discussion

No community discussion yet for this question.

Full 1D0-61B Practice