Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If you were programming a calendar in HTML would you use Table tags or Div tags?

Tags:

I converted my company's calendar to XSL and changed all the tables to divs. It worked pretty well, but I had a lot of 8 day week bugs to work out initially owing to precarious cross-browser spacing issues. But I was reading another post regarding when to use tables v. divs and the consensus seemed to be that you should only use divs for true divisions between parts of the webpage, and only use tables for tabular data.

I'm not sure I could even have used tables with XSL but I wanted to follow up that discussion of Divs and Tables with a discussion of the ideal way to make a web calendars and maybe a union of the two.

like image 873
Peter Turner Avatar asked Sep 03 '08 17:09

Peter Turner


2 Answers

A calendar is the perfect reason to use a table! Calendars inherently present tabular data and HTML tables are good at presenting tabular data. And HTML table markup provides nearly all the CSS hooks you need to associate CSS selectors with various parts of the table to dress it up.

I'm all for using DIVs for layout--but stick with tables for tabular data.

Here is a cool article on how to dress up tables with CSS: http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs

like image 138
rp. Avatar answered Sep 28 '22 04:09

rp.


I would say that a calendar is a table, therefore making the table the proper markup for its representation.

Edit: Definition 11 for "table" from answers.com says:

An orderly arrangement of data, especially one in which the data are arranged in columns and rows in an essentially rectangular form.

like image 24
Neall Avatar answered Sep 28 '22 04:09

Neall