10 March 2004
Semantically Speaking: XHTML Calendar
I have been developing a Calendar control over the last few days. You can find a version of it here (at the time of writing) . This version is already out of date - since I have found a better way of binding in the data needed, and looping through the days of the month while pulling the data. This is being developed for a schedule system that I am doing for Baglan IT.
However, one of my main concerns is that the XHTML I am using at the moment does not hold enough semantic meaning. So if the CSS is removed, it still makes sense, but not that much sense. The code looks a bit like this at the moment.
<div class="pageblank"> </div> <div class="pageblank"> </div> <div class="page"> 1</div> <div class="page"> 2</div> <div class="page"> 3</div> <div class="page"> 5</div> <div class="page"> 29</div> <div class="page"> 30</div> <div class="pageblank"> </div> <div class="pageblank"> </div>
The question that is bugging me is whether is can be better than this? The only better step that I can think of at the moment is using a Ordered List to display the days of the month, and carry on using empty div's to fill in the blank days of the calendar - since these days have no semantic meaning when the CSS is not applied anyway.
The code would then look something like this:
<div class="pageblank"> </div> <div class="pageblank"> </div> <ol> <li> 1</li> <li> 2</li> <li> 3</li> <li> 4</li> <li> 29</li> <li> 30</li> <ol> <div class="pageblank"> </div> <div class="pageblank"> </div>
Please let me know if you can think of a better way of marking up the calendar. I am looking for the best Semantic markup.
- Time: 01:08
- Wubb Development
Comments ( 8 )
Hasan
Phil Baines
If you can find the link to that discussion that would be great.
Also, it makes it easier to write the server side control usings <div> 's or <li> 's than <tr> and <td> .
But, yeah, I'd love to see what other people have said about it.
phil baines
http://archivist.incutio.com/viewlist/css-discuss/21555
It seems you are right about the most obviose markup being a table. But I really need to leave tables out of this one, so that it can also be given in a list format.
So, what would be the next best semantic markup for a calendar??
I think ordered list. But i am not sure.
Hasan
<h2> March 2004</h2>
<ul id="days">
<li> Sunday</li>
<li> Monday</li> etc...
</ul>
<ul class="Sundays">
<li>  </li>
<li> 7</li>
<li> 14</li>
<li> 21</li> etc...
</ul>
<ul class="Mondays">
<li> 1</li>
<li> 8</li>
<li> 15</li> etc...
</ul>
What do you think?
Hasan
#days {display: inline}
ul.Sundays {float: left}
ul.Mondays {float: left}
It will be a beast to get the margins and paddings to work cross-browser, but who said semantics was easy?
Hasan
Phil Baines
It's not just a simple calendar, becuase it have to bind to a recordset. Either using ASP/ASP.net or PHP.
What I am saying is that strcuture would be really hard to program.
I am not sure though, I will look at it.
poker games
poker games
Sorry, commenting has been disabled for a while. I am getting a stupid amount of comment spam, and need to find a new way of doing things.
I will not publish your email address, but I may use it to get in contact with you.
HTML tags and entities display as source; they do not render. To create a live link, simply type the URL (including http://).