This is not too pretty, so obviously we want to make it stop.
Here’s the method I used:
Here are two examples, one that exhibits the flashing problem, and another that fixes it using the technique described above. Note that in order to see the flashing problem, you need a slow internet connection: I recommend throttling your connection using the excellent Charles Web Debugging Proxy.
Bobby describes an alternate technique in case you are serving XHTML pages that use MIME type application/xhtml+xml.
Steve Clay makes a valid point that we should check for DOM compatibility before writing the styles on the page.