2004-07-28

DOM/CSS

I played around with DOM and CSS some more, trying to get the calendar from yesterday to embed well.  I had discovered that the CSS that I was using to format the calendar could be easily overridden by CSS that applies to containing elements, causing the calendar to look bad in those circumstances.  For example, I had rules with selectors such as "table.calendar td".  Unfortunately, when I tried to embed the calendar in a containing document that used selectors such as "div.container td", the latter's rules would override the former's whenever the calendar nested within the container's selected elements.  In CSS 2, one can write much more picky selectors, such as "table.calendar > tbody > td" which are very specific.  Alas, CSS 2 is neither widespread, nor well implemented.  So, I rewrote the calendar HTML and CSS so that every calendar element that needed styling would have an unambiguous ID or class.  As an example of an embedding document, see 2004-08.html.