Just load CSS into the head before the scripts force it to load, but not display , before running the scripts. This is a problem, for example, for checking the positions of elements upon loading, which, when launched after loading CSS, but before displaying them, give the wrong answer.
If you have code that really depends on your CSS, using $(window).load(function () {...}) can save you a lot of headaches in the race.
source share