Coding a Calendar

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I'm thinking about writing a simple little program for an online calendar. I know there are some already out there, but none of them have been quite as simple as I'd like.

Programming aside, I was wondering whether a calendar is considered proper use of a table. Or should I code all the little calendar days with CSS?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I would say that it is a table. Doesn't really make sense to float a bunch of divs. Divs really have no semantic meaning. The table defines a relationship between cells. Or you could do it as a list. That might be best actually. What is a calendar? It's a list of dates.... except that the dates all have to line up, which makes it more like a table.

It will be nice when the semantic web gets going and maybe we'll have a standard set of markup for stuff like this.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

A calendar would be proper use of a grid, if that existed. Table is near enough.

He has: 1,758 posts

Joined: Jul 2002

I'm actually working on a calendar app myself and I use tables for my calendars (just make sure to use semantically correct code like etc to keep them accessible).

Andy

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

I'd agree that this is an acceptable use of a table, the clincher IMO is that it has headings. The month, and days plus anything else that should be in the heading area.

A list doesn't have any equivalent to a tables ''.

a Padded Cell our articles site!

He has: 578 posts

Joined: Jun 2004

While I agree this is definitely an acceptable use of a table (i think the simplebits guy had an article on this, can't seem to find it) I also saw someone use lists to build a calendar and this made it extremely flexible for things like mobile. I don't know what your needs are, but just thought I'd mention this.

Ayy... i'm all over the place. This is neither article i mentioned previously (I can't seem to find either) but it is relavent:

http://veerle.duoh.com/index.php/blog/comments/a_css_styled_calendar/

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.