What is td in html

Last updated: April 1, 2026

Quick Answer: The `<td>` tag in HTML represents a table data cell, containing content displayed within a table row. It's paired with `<tr>` for rows and `<table>` elements to structure tabular data.

Key Facts

The HTML TD Tag

The <td> tag defines a table data cell in HTML. Standing for 'table data', this element contains the actual content displayed within table cells. Every must be contained within a (table row) element, and rows reside within a

element.

Basic HTML Table Structure

A properly structured HTML table follows this hierarchy:

TD Tag Attributes

The

tag accepts several important attributes:

  • colspan - Specifies how many columns the cell spans (default is 1)
  • rowspan - Specifies how many rows the cell spans (default is 1)
  • class - Applies CSS styling to the cell
  • id - Provides unique identifier for the cell

Example Usage

A simple two-row, two-column table with

elements might look like: <table><tr><td>Cell 1</td><td>Cell 2</td></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table>. This creates a 2x2 grid of data cells.

Accessibility Considerations

Using

correctly with proper table structure improves accessibility. Screen readers navigate tables more effectively when headers use tags and data uses tags. Always associate headers with data cells using scope attributes for better semantic meaning and user experience.

Related Questions

What is the difference between <td> and <th> tags?

<td> represents regular table data cells, while <th> represents table header cells. Headers typically appear bold and centered by default, identifying what data each column contains. Use <th> for headers and <td> for data.

How do I make a cell span multiple columns?

Use the colspan attribute on the <td> tag, like <td colspan='2'>, to make a cell span multiple columns. The value indicates how many columns the cell should occupy in that row.

Can I style individual <td> elements?

Yes, you can style <td> elements using CSS classes, inline styles, or direct CSS selectors. Apply background colors, borders, padding, and other properties to format table cells as needed.