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

ID : 274554

viewed : 33

Tags : htmlxsltcalendarhtml





Top 5 Answer for xslt - If you were programming a calendar in HTML would you use Table tags or Div tags?

vote vote

95

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

vote vote

84

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.

vote vote

72

I think this is definitely a case for using tables. The biggest issue when using divs would be box height for each individual day. If you're styling each box with a border, they could look off if the content for one day is longer than another. The additional markup to make it look right would be more than it would take to create it with a table, so I don't think divs are worth the extra effort in this case.

vote vote

70

It makes sense to use tables, but if you were to look at Google Calender, they seem to be using div tags. It is possible that using div tags lowers the file size, so in an enterprise environment it might be worth the 'trouble'.

vote vote

58

Do it up in a table.

Also don't think of it as "divs vs. tables" Think of it as tables vs. a proper semantic tag with meaning. When I author pages I try to use divs as little as possible, in a lot of cases you could be using a paragraph, a list item, etc.

Top 3 video Explaining xslt - If you were programming a calendar in HTML would you use Table tags or Div tags?







Related QUESTION?