Introducing the HTML5 Table API
The Alternative to CSS grids we’ve all been waiting for
The problem with modern web design
Since the introduction of the world wide web, designing websites with robust and flexible layouts has confounded developers. Overtime, using divs to size and position content elements became a common practice. While this works, it’s more of hack that is not without its issues. For instance:
- divs are semantically meaningless
- requires the use complicated C.S.S (California Style Sheet) properties
- they are not inherently responsive
- they incur a huge performance impact, especially on mobile devices
- there are many issues with “crawlability” of content contained with in a div delement
- jQuery, a library with a large carbon footprint, is needed to add content to DIVs
HTML 5 Tables
While browsing W3Schools (the best resource for all developers, expert or novice) I happened upon a newly approved API (Automatic Programming Interface) called ‘tables’. But I know what you’re thinking. I’m not going to use an experimental API feature on my blog. True, but here’s the crazy thing: Microsoft has patched all its old browsers (IE 5.5+) to support the new table API. So they are fairly safe to use. (Although the API might change unexpectedly in the future)
An HTML table consists of 3 parts. The table element, which is the root; tr, which represents a table row, and tc, or table column. An easy way to remember this is table stands for “table”, tr stands for “table row”, and tc stands for “table column”
If you’ve used a DIV based css grid (DBCG) before, you might be familiar with this. The Table API was probably modeled after this so that developers would be instantly familiar with the new API.
So what’s the difference? In DBCG’s, tables, rows and columns are all represented using the div element (hence the name). This is a big no-no. As it completely destroys the informational hierarchy of your content. People who do this are called Anti-Semantics.
With tables, the divs are replaced by their properly semantic cousins. And the C.S.S is built right into the browser. Theres nothing more for you to do.
Below I will take you through an extremely simple, yet power, table sample.
And the Result:
There is absolutely no CSS styling involved there and this flows & resizes properly, works cross browser, and most importantly, it looks beautiful.
“It can’t be that easy”
Tables aren’t without their own drawbacks however. For instance, they can be extremely complicated to set up initially. That’s why I’ve built Tablr, an HTML 5 Table template bootstrap. From there you can completely customize your own Table and download the source for use in non-profit projects. (Commercial and Corporate Volume licenses also available)
The answer we’ve been praying for
I really believe in Tables. They are exactly what web developers have been asking for for years now. Finally Microsoft has listened and given us a new tool for creating sophisticated websites. Thank you, Flying Spaghetti Monster.
“The Future of the web has passed” — Nicholas Ortenzio
Nicholas Ortenzio is a software developer & olympic hoverboarder