Workaround for the Safari FOUC bug
A workaround is to hide the body before the CSS files have loaded, and show the body afterwards:
body { display: none; }
body { display: block; }
Save these lines as safari-fouc-workaround-1.css and safari-fouc-workaround-2.css, respectively. Then place the following at the top of the <head> section, before your CSS declarations:
<link rel="stylesheet" type="text/css" media="screen" href="/safari-fouc-workaround-1.css" />
And after your CSS declarations, at the bottom of the <head> section, put:
<link rel="stylesheet" type="text/css" media="screen" href="/safari-fouc-workaround-2.css" />
(Even better, add these lines only if you detect that the browser is Safari.)
Put the following in <head>:
<?phpand the following at the end of your main CSS file:
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE) { ?>
<!-- First part of FOUC workaround -->
<style type="text/css">body { display: none; }</style>
<?php
}
/* Second part of FOUC workaround */
body { display: block; }