Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!

For the past eight(8) years Schalk Neethling has been working as a freelance developer under the pseudo of Volume4 and is now the president of Overt Strategy Consulting. During this period he has completed over 300 projects ranging from full web application development to complete branding. As president and lead developer of Overt Strategy Consulting, Schalk Neethling and his team has released a 100% Java standards based content management system called AlliedBridge and business document exchange and review system, called Doc-Central. Schalk Neethling is also actively involved on a daily basis in the open source, web standards and accessibility areas and is a current active member of the Web Standards Group. Schalk is also the co-founder and president of the non-profit The South Web Standards and Accessibility Group, which aims to actively educate and raise awareness of web standards and accessibility to both the developer society as well as business large and small. Schalk also has a long relationship with DZone and is currently zone leader for both the web builder, css.dzone.com, as well as the .NET zone, dotnet.dzone.com, and you can find a lot of his writing there as well as on his blog located at schalkneethling.alliedbridge.com. Schalk is constantly expanding on his knowledge of various aspects of technology and loves to stay in touch with the latest happenings. For Schalk web development and the internet is not just a job, it is a love, a passion and a life style. Schalk has posted 173 posts at DZone. View Full User Profile

Tables For Layout, Still Using It? CSS3 Table Style, I Am Not Sure...

12.31.2008
Email
Views: 5394
  • submit to reddit

With the uptake of CSS and the movement against using tables for layout, are you still doing things the old way?

In the standards world, tables are not evil but, when used for layout, it definitely is. I do not think that the CSS alternative to tables in CSS3 should ever be implemented. Why? Abuse. The HTML table element when used for the right reasons can be powerful and should be the way one displays tabular data. What do you think?

If you still use traditional HTML tables for layout, why?

Preaching coming up, HTML is about the structure of the document. CSS was meant to ad the style/visual layer to the document. To my mind, allowing one to layout pages using a table like structure with CSS makes little sense. What do you think? 

Published at DZone with permission of its author, Schalk Neethling.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Danail Nachev replied on Fri, 2009/01/02 - 4:21am

I think that CSS needs a good layout mechanism, something like the desktop Layout managers, which are quite powerful and don't step in your way.

Schalk Neethling replied on Fri, 2009/01/02 - 7:06am

@Danail Nachev, I completely agree. A layout system would definitely be preferable to using 'CSS tables'. With all of the 'little known' or 'advanced' HTML table tags such as caption, colscope etc. HTML tables provide much greater accessibility.

The other aspect is that there are so many other great enhancements to CSS in CSS3 that, I think, browser vendors should rather focus on implementing those then 'CSS tables'  

Vladimir Carrer replied on Fri, 2009/01/02 - 10:23am

I think the main objective should be  cleaner more comprehensive HTML code. The old html tables were some kind of "hack" for building layouts.

Even CSS is not meant to be construct for layouts and we are still using hacks for building CSS layouts. We definitely need new layouts system  maybe based on CSS to separate the layout from presentation HTML, based on some intuitive system. Certainly the "new" CSS  tables are not solution for everything.

Tables should be used for displaying table data.I hope that CSS 3 will bring some new layout system.

Prem Kurian Philip replied on Fri, 2009/01/02 - 4:06pm in response to: Volume4

If CSS and javascript were modified a little bit, it would really help. Some from my wishlist:

1. When you have one div after another, place them horizontally one after the other irrespective of the size of the browser window.  If there is too much content horizontally, the browser should just display the horizontal scrollbar instead of moving the divs down.

 Example:

<div id="top_level">
     <div id="column1">Text for column 1</div>        
     <div id="column2"> Text for column 2 </div>
     <div id="column3">  Text for column 3 </div>

<div id="column4" style="start: left">
     </div> 
      <div id="column5">Text for column 5</div> 
</div> 

In this examples, the divs with ids "column1", "column2", and "column3" should all come horizontally next to each other all starting from the same vertical position within the page.

Div with the id "column4" should go below "column1" and be aligned against the left edge of the browser window.Column5 div will line up to the right of the "column4" div.

2. Use additional relational markup for specifying properties of DOM elements. 

 Example:

 <div id="top_level">

    <div id="column1">Some random content of variable length and therefore height comes here</div>

     <div  id="column2" style="width: height: constraint(#column2: height)">Column2</div>

</div>

 Here "column2" div will have its height set automatically based on the  height of the DOM object with the id "column2". This means that "column2" will grow or shrink in tandem with "column1".

 

3. The browser should set valid values for ALL attributes of DOM elements with sensible defaults for those attributes which have not been explicitly specified using stylesheets or javascript functions.

Example:

 <div id="top_level" style="width: 300px">

</div>

<script>

   var toplevelDiv = document.getElementById("top_level");

   /*This will display nothing as style.left hasn't been explicity set in the style sheet or via javascript. */

   alert(topLevelDiv.style.left);  

   /* This will display the width of the div - 300px*/

   alert(topLevelDiv.style.width);

</script>

Here, whether the "style.left" property was explicity specified or not, the browser does know what the "left" attribute of a  DIV should return because a browser needs to be able to determine how to render any DOM element. So why doesn't the browser set valid values for all attributes of each DOM element.

 4.  This is not directly related to CSS however it has some bearing on CSS. There should be a support for a "Canvas" functionality and javascript should be include a drawing API so that arbitary shapes can be drawn in these canvases. In short, Javascript should be directly usable for rendering

 Example:

<canvas id="my_canvas" height="200px" width="200px">

   <circle id="circle1" x="100px" y="100px" radius="30px">

   </circle>

</canvas>

<script>

    var myCanvas = document.getElementById("my_canvas");

    myCanvas.drawCircle(100, 100, 50);

    myCanvas.drawPolygon(...)

</script>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.