On Tue, 14 Sep 2010 14:54:19 -0400, Johannes Hofmann <Johannes.Hofmann@gmx.de> wrote:
It took me a while to find out, but the reason is rather simple:
The <html> is opened before the style is loaded (it's in <head> after all). So at the time we call startElement() for <html>, we don't have the style information.
I didn't find anything in the CSS reference how to handle this case, but major browsers seem to allow CSS for the html-element.
We could somehow delay the startElement() call for <html> until <head> is parsed completely, but I have to look for a way to make this hack not too ugly... Suggestions welcome :-)
Cheers, Johannes
Maybe treat it, for CSS purposes, like a second <body> tag? i.e. rather than delay startElement(), map CSS attributes assigned to "html" to some pseudo-element parsed just before <body>. That might be a really stupid idea, but it makes sense to me since that's how <html> usually behaves, CSS-wise. For example, on my own sites I use something like html { background: #202020; color: #202020; } body { background: white; width: 6in; margin: 2em auto 2em auto; padding: 1em 4em 1em 4em; border: 2px solid black; } to display the body as a white box against a black background. ~Benjamin