{"id":47,"date":"2005-02-19T10:23:23","date_gmt":"2005-02-19T15:23:23","guid":{"rendered":"http:\/\/www.killersites.com\/blog\/?p=47"},"modified":"2017-02-23T10:08:05","modified_gmt":"2017-02-23T15:08:05","slug":"what-are-css-tables","status":"publish","type":"post","link":"https:\/\/www.killersites.com\/blog\/2005\/what-are-css-tables\/","title":{"rendered":"What are CSS tables?"},"content":{"rendered":"<p>NOTE: This article is theoretical &#8211; CSS tables are not supported by the browsers yet, and cannot be used. I wrote this article to make a few points and to expose people to lessons learned in software development: that grids are an excellent way to layout user interfaces.<\/p>\n<p><em>Stefan<\/em><\/p>\n<p>&#8211;<\/p>\n<p>Grid layout patterns are commonly used in creating software interfaces &#8211; in web design we call them &#8216;tables&#8217;. <\/p>\n<p>But today HTML table based layout is generally frowned upon because:<\/p>\n<ol>\n<li>HTML tables render\/display content in a fixed format\/style that might not display properly in certain types of browsers.<\/li>\n<li>Tables semantic meaning is thought to represent tabular data &#8211; like a spread sheet. Thus using them for page level layout is just wrong &#8230; gosh darn it!<\/li>\n<\/ol>\n<p>There are other reasons why some web designers will say HTML tables suck:<\/p>\n<ul>\n<li>HTML tables cause code to be bloated and thus pages will take longer to download.<\/li>\n<li>HTML tables will make your website less search engine friendly.<\/li>\n<li>HTML tables will make your websites less accessible.<\/li>\n<\/ul>\n<p>The last 3 points are myths and should be ignored &#8211; I covered that in other articles. <\/p>\n<p>That being said, the first point about tables imposing a fixed format\/style (where formatting and structure are intertwined &#8211; that&#8217;s bad,) is very real and very important. It is  so important in fact, that I will do what I can to avoid table based layout despite the extra work and problems this can cause.<\/p>\n<p><strong>It&#8217;s a terrible shame<\/strong><\/p>\n<p>Using a grid\/table to create UI&#8217;s is  intuitive, too bad that table based layouts are so controversial &#8230; but there maybe is a light at the end of the web UI tunnel: CSS table layouts.<\/p>\n<p><strong>What the heck are CSS tables?<\/strong><\/p>\n<p>From the W3C:<\/p>\n<blockquote><p>&#8216;The CSS table model is based on the HTML 4.0 table model, in which the structure of a table closely parallels the visual layout of the table.&#8217;<\/p><\/blockquote>\n<p><strong>Now in English:<\/strong><\/p>\n<p>CSS tables are just a set of CSS attributes that you can apply to (probably) div tags to create a &#8216;table&#8217;. Check out this code snippet and things should clear up:<\/p>\n<div class=\"codeblock\">\n<p>\n  &lt;div class=&#8221;table&#8221;&gt;<br \/>\n   &lt;div class=&#8221;row&#8221;&gt;<br \/>\n&lt;div class=&#8221;cell&#8221;&gt;<br \/>\n&lt;p&gt;Yallow!&lt;\/p&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<\/div>\n<p>This is an official <a target=\"_blank\" href=\"http:\/\/www.w3.org\/TR\/REC-CSS2\/tables.html#q2\">W3C specification<\/a>, I&#8217;m not inventing anything here! <\/p>\n<p><strong>So why invent CSS tables when we have HTML tables?<\/strong><\/p>\n<p>The answer is simple young grasshoppers: to gain the advantage of table based layout while avoiding the problems (mentioned above) with HTML tables:<\/p>\n<ol>\n<li>HTML tables format content in a fixed structure that might not render properly in certain browsers.<\/li>\n<li>Tables semantic meaning is thought to represent tabular data &#8211; like a spread sheet. Thus using them for page level layout is just wrong.<\/li>\n<\/ol>\n<p><strong>CSS tables can&#8217;t be used in any browser today, so why mention them?<\/strong><\/p>\n<p>I have two reasons why I wrote this article:<\/p>\n<ol>\n<li>To educate people of this long term possibility and maybe to start stirring things up &#8211; it would nice to have this web design tool.<\/li>\n<li>To make a point about grid based layouts:  they have merit and should be considered.<\/li>\n<\/ol>\n<p>Stefan Mischook<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Grid layout patterns are commonly used in creating software interfaces &#8211; in web design we call them &#039;tables&#039;. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[104,103],"_links":{"self":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":2,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":4788,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/posts\/47\/revisions\/4788"}],"wp:attachment":[{"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.killersites.com\/blog\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}