It would be good to check the validity of the code we generate, I'm pretty sure we will find multiple issues or things we could improve. We can use the W3C HTML or CSS validators:
For example, I'm pretty sure we don't add the DOCTYPE declaration in the beginning of our generated HTML.