> Markdown version of [/magazine/583-spot-the-mistakes-html-tables](https://www.wearedevelopers.com/magazine/583-spot-the-mistakes-html-tables). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Spot the Mistakes: HTML Tables **By:** [Daniel Cranney](https://www.wearedevelopers.com/@daniel-cranney) **Published:** April 30, 2025 When it comes to HTML, tables don’t get the respect they deserve. Despite being a part of HTML since 1997 - and with many others tags from the time now being deprecated - tables are considered by many to be awkward, verbose and perhaps even unnecessary (_I know what you’re thinking, could we just use divs?_). The fact is, HTML tables are readable, keep information organised, and come with accessibility features, too (like caption). In this article, we’ve made some mistakes in a table, and want you to spot them. **Let us know on socials if you spot the five mistakes, or check the bottom of the article for answers.** ## The Code <table> <thead> <tr> <th>Product</th> <th>Price<th> </tr> </thead <tbody> <tr> <td>Apple</td> <td>$1</td> </tr> <div> <tr> <td>Banana</td> <td>$0.50</td> </tr> </div> <tr> <td>Cherry <td>$2 </tr> </tbody> </table> ## The Answers Think you’ve found the answers? See if you found them all below. Mistake 1 **Unclosed \<th\> tag for "Price"** The "Price" column header doesn't have a proper closing tag. It ends with `<th>` instead of `</th>`, breaking the table structure. Mistake 2 **Missing closing \</thead\> tag** The `<thead>` is left open (`</thead` missing a closing `>`), causing invalid nesting for the table sections. Mistake 3 **Invalid \<div\> inside \<tbody\>** A `<div>` element is incorrectly placed inside the table's `<tbody>`. Only table-related tags like `<tr>`, `<td>`, and `<th>` are allowed inside tables. Mistake 4 **Missing closing \</td\> tags in "Cherry" row** The "Cherry" product and its price don't have their `</td>` tags closed. This can cause browsers to misinterpret the layout and break the table visually or semantically. Mistake 5 **Missing \<caption\> element for table** A `<caption>` describing the purpose of the table is missing. While not strictly required, it greatly improves accessibility, especially for screen reader users. ## Related Articles - [Spot the Mistakes: A Paragraph with Problems](https://www.wearedevelopers.com/magazine/574-spot-the-mistakes-a-paragraph-with-problems) - [Spot the Mistakes: HTML Forms](https://www.wearedevelopers.com/magazine/577-spot-the-mistakes-html-forms) - [Spot the Mistakes: CSS](https://www.wearedevelopers.com/magazine/589-spot-the-mistakes-css) - [Semantic HTML Elements You’re (Probably) Not Using But Should](https://www.wearedevelopers.com/magazine/667-semantic-html-elements-you-re-probably-not-using-but-should) ## Related Videos - [Semantic HTML means it's semantic, right? Right?](https://www.wearedevelopers.com/videos/1674-semantic-html-means-it-s-semantic-right-right) - [82 Bugs I Collected in a Year You Won’t Believe Made It to Production](https://www.wearedevelopers.com/videos/1581-82-bugs-i-collected-in-a-year-you-won-t-believe-made-it-to-production) - [Using all the HTML, Running State of the Browser and "Modern" is Rubbish](https://www.wearedevelopers.com/videos/1291-using-all-the-html-running-state-of-the-browser-and-modern-is-rubbish) - [The Resilience of the World Wide Web](https://www.wearedevelopers.com/videos/1281-the-resilience-of-the-world-wide-web) ## Related Jobs - [Senior Product UI Designer](https://www.wearedevelopers.com/jobs/ext/1998621-senior-product-ui-designer) at **Almedia** - [Software Engineer Frontend (all genders welcome) in the field of Water Line Integrity Solutions](https://www.wearedevelopers.com/jobs/ext/127888-software-engineer-frontend-all-genders-welcome-in-the-field-of-water-line-integrity-solutions) at **Rosenxt Group** - [Remote Senior Full-Stack Engineer](https://www.wearedevelopers.com/jobs/ext/679408-remote-senior-full-stack-engineer) at **Edge Impulse** - [Remote Senior Full-Stack Engineer](https://www.wearedevelopers.com/jobs/ext/682327-remote-senior-full-stack-engineer) at **Edge Impulse** - [Remote Senior Full-Stack Engineer](https://www.wearedevelopers.com/jobs/ext/683045-remote-senior-full-stack-engineer) at **Edge Impulse** - [Remote Senior Full-Stack Engineer](https://www.wearedevelopers.com/jobs/ext/646086-remote-senior-full-stack-engineer) at **Edge Impulse**