0

I'm developing a online registration system. I have my CSS files loaded in javascript file using "skel.init". When loading other pages or refreshing the website. It loads CSS pretty slow that my website will appear with no css for almost 1 sec while loading. Are there any solutions that can fix this? (P.S. It's not my network's problem. I had my network tested)

Eric Turner
  • 41
  • 1
  • 5
  • `` the css in the head normally so it can be optimized by the browser... – dandavis Aug 18 '16 at 02:40
  • why on earth you using javascript too load the css – Fiido93 Aug 18 '16 at 03:09
  • Um.. In fact, I'm not the one who design the web, my colleague did. He just gave it to me and I code the modules and controllers parts. But he doesn't know how to fix this problem, either. So here I am. – Eric Turner Aug 18 '16 at 05:30

2 Answers2

2

If you load your CSS via a <link> in the <head> of your page, the browser will load the CSS before the HTML content of the page and you will not see the site without the proper CSS applied.

TW80000
  • 1,507
  • 1
  • 11
  • 18
  • Thanks a lot, but is there any other solutions? Cuz my stylesheets are control by my javascript. So if I load my CSS via , some of the style will fail. – Eric Turner Aug 18 '16 at 05:24
  • 1
    Out of interest, why are your stylesheets "controlled" by your Javascript? – deadwards Aug 18 '16 at 07:08
1

I know the problem... This is called the Flash of Unstyled Content. I solve this on Eliminate flash of unstyled content

Community
  • 1
  • 1
Eric Turner
  • 41
  • 1
  • 5