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)

asked Aug 18, 2016 at 2:38
3
  • <link> the css in the head normally so it can be optimized by the browser... Commented Aug 18, 2016 at 2:40
  • why on earth you using javascript too load the css Commented Aug 18, 2016 at 3: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. Commented Aug 18, 2016 at 5:30

2 Answers 2

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.

answered Aug 18, 2016 at 2:45

2 Comments

Thanks a lot, but is there any other solutions? Cuz my stylesheets are control by my javascript. So if I load my CSS via <link>, some of the style will fail.
Out of interest, why are your stylesheets "controlled" by your Javascript?
1

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

answered Aug 18, 2016 at 7:05

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.