
Generating HTML Tables Is a Solved Problem (Stop Writing Them by Hand)
I used to write HTML tables by hand. Every <tr> , every <td> , every closing tag, every colspan attribute. It is the most tedious part of HTML authoring, and there is zero reason to do it manually when you know the data. A 10-row, 5-column table is 50 cells. That is 50 <td> tags, 50 closing </td> tags, 10 <tr> tags, 10 closing </tr> tags, plus the <table> , <thead> , <tbody> wrappers. Around 130 lines of markup for something that took 2 minutes to conceive. The markdown approach Markdown tables are the fastest way to express tabular data: | Name | Role | Team | |---------|-----------|----------| | Alice | Engineer | Platform | | Bob | Designer | Product | | Charlie | PM | Growth | Clean, readable, and most markdown processors convert them to proper HTML tables. But markdown tables have serious limitations. You cannot merge cells (colspan/rowspan). You cannot nest elements inside cells. You cannot style individual cells. You cannot add a caption. For documentation and README files, mark
Continue reading on Dev.to Webdev
Opens in a new tab




