nerdexam
CIW

1D0-610 · Question #13

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 correct because browsers apply two default styles to it: text-align: center (horizontal centering) and vertical-align: middle (vertical centering), making it the only table element that centers content on both axes out of the box. <td> (table data) is…

CIW Site Development Associate

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

(66 responses)
  • A
    2% (1)
  • B
    2% (1)
  • C
    92% (61)
  • D
    5% (3)

Explanation

<th> (table header) is correct because browsers apply two default styles to it: text-align: center (horizontal centering) and vertical-align: middle (vertical centering), making it the only table element that centers content on both axes out of the box.

<td> (table data) is wrong because while it shares the vertical-align: middle default, its horizontal alignment defaults to text-align: left - so it only centers on one axis. <tr> is a row container, not a cell element, so it holds no direct content to align. <pre> is unrelated to tables entirely; it preserves whitespace and uses a monospace font for preformatted text.

Memory tip: Think of <th> as the "headline" of a table - headlines are always centered and prominent (bold), which mirrors the browser defaults that set it apart from plain <td> cells.

Topics

#HTML tables#Table cell alignment#Table headers#Default styling

Community Discussion

8
Ola B.Ola B.Feb 6, 2026

The correct answer is C, the th element. Browsers apply default styling to th that centers the text horizontally and vertically within the cell, and that behavior is baked into every major browser without you writing a single line of CSS. The td element gives you vertical centering by default but left-aligns horizontally, so it does not satisfy both conditions. If you want to confirm this yourself, spin up a quick CodePen or even a plain HTML file locally, drop a table in with both th and td cells, throw some content in, and just look at the difference in a browser, no guessing needed. tr is just a row container and pre is for preformatted text, so neither one is even in the conversation here.

25
Bao N.Bao N.Feb 17, 2026

td tricks you but th centers both axes by default, C wins.

5
Samuel O.Samuel O.Feb 19, 2026

The centering trick only holds up until you throw a percentage height on the td and the table itself lacks an explicit height, at which point you are chasing the same ghost you thought you left behind.

0
Samuel O.Samuel O.Feb 25, 2026

The th element is the right call here. Browser default styles render th content as bold and centered both horizontally and vertically within the cell, which is exactly what the question is testing. In actual table markup I have built for reporting dashboards, you never need to add text-align or vertical-align to a th because those defaults are baked into every major browser's user agent stylesheet. The td element, which trips up a lot of people on this one, only centers vertically by default and leaves the horizontal alignment to the left.

5
Bao N.Bao N.Feb 28, 2026

Solid breakdown, though worth flagging that vertical-align middle on th is technically a UA default but a few older mobile browsers have been inconsistent there, so if you are building anything that needs to hold up on legacy Android WebView you still want to be explicit.

0
Prof. SaraProf. SaraFeb 11, 2026

Correct, C. The th element applies center alignment on both axes by default, td does not.

3
Quincy P.Quincy P.Jan 26, 2026

D, pre renders with centered alignment in both axes straight out of the box.

-1
Ola B.Ola B.Jan 27, 2026

Quincy, the correct answer is C because pre renders its content in a monospace font and preserves whitespace and line breaks, but it does not apply any centering on its own, you have to add that yourself with CSS.

0
Full 1D0-610 Practice