Internet, Networking, & Security Web Development What's the Difference Between TH and TD HTML Table Tags? by Jennifer Kyrnin Freelance Contributor Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML. our editorial process LinkedIn Jennifer Kyrnin Updated on November 29, 2019 Getty Images Web Development CSS & HTML Web Design SQL Tweet Share Email Tables have long gotten a bad rap in web design. Many years ago, HTML tables were used for layout, which was obviously not what they were intended for. As CSS rose to popular usage for website layouts, the idea that "tables are bad" took hold. Unfortunately, many people misunderstood this to mean that HTML tables are all bad, all the time. That is not the case at all. The reality is that HTML tables are bad when they used for something other than their true purpose, which is to display tabular data (spreadsheets, calendars, etc.). If you are building a website and have a page with this kind of tabular data, you should not hesitate to use an HTML table on your page. What Do <td> and <th> Do? The <td> tag, or "table data" tag, creates table cells within a table row in an HTML table. This is the HTML tag that contains any text and images. Basically, this is the workhorse tag of your table. The tags will contain the content of the HTML table. The <th> tag, or "table header," is similar to the <td> in many ways. It can contain the same kind of information (although you wouldn't put an image in a <th>), but it defines that specific cell as a table header. Most web browsers change the font-weight to bold and center the content in a cell. Of course, you can use CSS styles to make those table headers, as well as the contents of your tags, look any way that you would like them to look on the rendered webpage. When Should You Use <th> Rather Than <td>? The <th> tag should be used when you want to designate the content in the cell as a header for that column or row. The table header cells are typically found at the top of the table or along the side — basically, the headings at the top of columns or the headings to the very left or the start of a row. These headers are used to define what the content below or beside them is, making the table and its contents much easier to review and process quickly. Do not use <th> to style your cells. Because browsers tend to display table header cells differently, some lazy web designers may try to take advantage of this and use the tag when they want the contents to be bold and centered. This is bad for several reasons: You can't rely on web browsers always displaying the content that way. Future browsers might change the color by default, or make no visual changes at all to <th> content. You should never rely solely on default browser styles and should never use an HTML element because of how it "looks" by default.It's semantically incorrect. User agents that read the text may add audible formatting such as "row header: your text" to indicate that it's in a <th> cell. Additionally, some web applications print the table headers across the top of each page, which would result in problems if the cell is not actually a header but is instead being used for stylistic reasons only. Bottom line — using tags in this way can cause accessibility issues for many users, especially those using assisted devices to access your site content.You should use CSS to define how the cells look. The separation of style (CSS) and structure (HTML) has been a best practice in web design for many years. Once again, use a because the content of that cell is a header, not because you like the way the browser is likely to render that content by default.