
Originally Posted by
MattyMC
[...] I'm creating a calendar using divs and spans.
Don't. Use a table. You have a relationship between column headings (days of the week) and cells within the table body, so a table element should be used to reflect that relationship.
I was wondering if anyone knew what the problem was.
There are many, not just with the CSS, but the markup itself, as well.
Incidentally, when posting code and HTML, use the or pseudo-tags.
<span id="CalendarHeadItem">Sunday </span>
<span id="CalendarHeadItem">Monday </span>
The first problem is that id attribute values must be unique within a document. If you want to label multiple elements, use the class attribute which can contain a space-separated list of class names.
That said, you should also use the document structure to full effect. If all span elements within the header are items, then use
Code:
.calendar .head span {
/* ... */
}
HTML Code:
<div class="calendar">
<div class="head">
<span>...</span>
<span>...</span>
</div>
</div>
rather than
Code:
.calendar .head .item {
/* ... */
}
HTML Code:
<div class="calendar">
<div class="head">
<span class="item">...</span>
<span class="item">...</span>
</div>
</div>
<div id="CalendarBody">
  <span id=CalendarBodyItemEmpty>
<!-- ... -->
  <span id=CalendarBodyItem>
A similar approach applies here. Rather than identify everything, specialise exceptions.
Code:
.calendar .body span {
/* Rules for normal items */
}
.calendar .body span.empty {
/* Rules for empty items, overriding others
* from the previous rule, if necessary.
*/
}
HTML Code:
<div class="calendar">
<div class="body">
<span>...</span>
<!-- ... -->
<span class="empty">...</span>
</div>
</div>
<a href=NewEvent.aspx?d=&m=10&y=2005>
That href attribute value must be quoted. There are times when attributes can be left unquoted, but only when the characters involved are part of a very restrictive set (letters, numbers, underscores [_], full stops [.], colons [:], and hyphens [-]). Unless you're willing to commit that to memory, just quote all attribute values. In addition, ampersands (&) are special characters in HTML as they delimit the start of a character entity reference. Whenever they should appear as literals, use the & entity. There are exceptions, though (like within script elements). Both of these corrections apply in numerous locations, and in other elements.
#CalendarHeadItem {
/* ... */
  width: 96px;
/* ... */
  text-align: center;
The span element is in-line, and as such neither the width property nor the text-align property can be applied to it. IE6 in 'Quirks' mode reflects bugs in IE5.x and purposely ignores this, but in 'Standards' mode it doesn't apply them (as it should).
Hope that helps,
Mike
Bookmarks