DEV Community

Discussion on: How to build a calendar with CSS Grid

Collapse
 
sandwich_hlp profile image
Michael Cohen

I hate to be the one to point this out, and I'm as excited about CSS Grids as the next person, and perhaps this is just an interesting exercise to try with Grids... but semantically, this style of one-week-per-row calendars should really be coded using regular HTML tables. ;)

Collapse
 
citguy profile image
Ryan Johnson

What makes tables a better choice?

Collapse
 
sandwich_hlp profile image
Michael Cohen

Semantics! :) Tables are for representing tabular data, which this style of calendar most certainly is. Each row is a separate week; each column a day of the week. As a bonus, even if the CSS doesn't load properly, a table will display a calendar in an eminently-sensible layout, whereas a calendar built just with semantically-meaningless <div>s will just look like a mess of text strings.

Remember, the kick-back against HTML tables was targeted at their being (mis)used for page layout, NOT against their use with tabular data! :)