<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Dave Dash</title>
 <link href="http://davedash.com/tag/table/atom.xml" rel="self"/>
 <link href="http://davedash.com/tag/table"/>
 <updated>2012-04-07T22:42:44-07:00</updated>
 <id>http://davedash.com/</id>
 <author>
   <name>Dave Dash</name>
   <email>dd+atom1@davedash.com</email>
 </author>

 
 <entry>
   <title>Table based layouts?  In this day in age?  Really?  How about grids?</title>
   <link href="http://davedash.com/2007/10/05/table-based-layouts-in-this-day-in-age-really-how-about-grids/"/>
   <updated>2007-10-05T00:00:00-07:00</updated>
   <id>http://davedash.com/2007/10/05/table-based-layouts-in-this-day-in-age-really-how-about-grids</id>
   <content type="html">&lt;p&gt;[tags]css, yui, grids, table, layout[/tags]&lt;/p&gt;

&lt;p&gt;I think there are three kinds of people:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;People who learned tables for layouts and went to CSS+&lt;code&gt;div&lt;/code&gt;s.&lt;/li&gt;
&lt;li&gt;People who learned tables for layouts and never needed to learn CSS+&lt;code&gt;div&lt;/code&gt;s (or insisted that this was way too complicated)&lt;/li&gt;
&lt;li&gt;People who never learned tables.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;I would argue in some ways the second class of people are right, tables are a lot easier.  Until you run into issues... and until you need to maintain your template code.&lt;/p&gt;

&lt;p&gt;Luckily there's grids.  Grids are easier than tables and easy to maintain and look at.  You can achieve just about anything with &lt;a href=&quot;http://developer.yahoo.com/yui/grids/&quot;&gt;grids&lt;/a&gt;.&lt;/p&gt;

&lt;!--next page--&gt;


&lt;!--more--&gt;


&lt;p&gt;Personally I like using &lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;Yahoo's YUI&lt;/a&gt; to get grid support.  It's a CSS framework in the same way that &lt;a href=&quot;http://jquery.com&quot;&gt;jQuery&lt;/a&gt; is a javascript framework or that &lt;a href=&quot;http://symfony-project.com/&quot;&gt;symfony&lt;/a&gt; is a PHP5 framework.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;YUI&lt;/a&gt; will normalize all your elements and give you a standard way to change the size of text and elements and give you &lt;a href=&quot;http://developer.yahoo.com/yui/grids/&quot;&gt;grids&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So it helps to think of your layout in terms of grids... or columns.  &lt;a href=&quot;http://developer.yahoo.com/yui/grids/&quot;&gt;YUI grids&lt;/a&gt; supports some common combinations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.yui-g&lt;/code&gt; - 2 equal size containers (nest to get 4).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.yui-gb&lt;/code&gt; - 3 equal size containers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.yui-gc&lt;/code&gt; - 2/3 - 1/3&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.yui-gd&lt;/code&gt; - 1/3 - 2/3&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.yui-ge&lt;/code&gt; - 3/4 - 1/4&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.yui-gf&lt;/code&gt; - 1/4 - 3/4&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Granted, this doesn't cover every scenario, but it's a start, and it's easy to build off of to create your own special sizes.&lt;/p&gt;

&lt;p&gt;So to create some magical columns you do the following:&lt;/p&gt;

&lt;div&gt;&lt;textarea name=&quot;code&quot; class=&quot;html&quot;&gt;
&lt;div class=&quot;yui-g&quot;&gt;
  &lt;div class=&quot;yui-u first&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;yui-u&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/textarea&gt;&lt;/div&gt;


&lt;p&gt;&lt;code&gt;yui-g&lt;/code&gt; can be substituted for any of the above classes.  &lt;code&gt;yui-u&lt;/code&gt; is your columns or grid cells.  &lt;code&gt;first&lt;/code&gt; indicates the first column since &lt;code&gt;:first&lt;/code&gt; isn't understood by some popular browsers.&lt;/p&gt;

&lt;p&gt;Now you know grids.  It's less complicated than the tabular equivalent:&lt;/p&gt;

&lt;div&gt;&lt;textarea name=&quot;code&quot; class=&quot;html&quot;&gt;
&lt;table class=&quot;layout&quot;&gt;
  &lt;tr class=&quot;first_row&quot;&gt;
    &lt;td class=&quot;col1&quot;&gt;&lt;/td&gt;
    &lt;td class=&quot;col2&quot;&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/textarea&gt;&lt;/div&gt;


&lt;p&gt;With the framework in place, it's a lot easier to quickly adjust your layouts, and the readability is huge especially as your layouts grow.&lt;/p&gt;
</content>
 </entry>
 

</feed>

