while (things) do {fall apart;}

My adventures in computer programming

HTML Tables

I have spent time developing tables on the web for radio stations who want to display their weekly schedule. In these tables, some shows span varying time slots - a half hour, one hour, two hours, etc. - and some shows repeat 5 days a week, while some are once a week only. This means a standard table - of an equal number of cells in each row, and in each column - does not suffice.

<table>
  <tr>
    <td>...</td>
    <td>...</td>
  </tr>
</table>

I assumed I had researched how to create this in the past. I was aware of the HTML table tags including to indicate a table cell. A tag can have a rowspan attribute to indicate how many rows it should extend, effectively ‘merging’ the cells from discrete rows into one tall cell. But I had overlooked the fact that there could also be a colspan attribute that allowed a cell to merge across multiple columns, making it wider. Together, these two attributes allowed me to build a real radio station schedule on the web.

<table>
  <tr>
    <td>7:00am</td>
    <td rowspan="2" colspan="5">Morning News Program</td>
  </tr>
  <tr>
    <td>7:30am</td>
  </tr>
  <tr>
    <td>8:00am</td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
</table>

Share