Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

1 second of delay of css on html page load?

Tags:

html

css

I have been trying to make some html and css pages. Every time when I load a page. It always give me about half a second flash of the html page without the css style. Anyone know why that happens and how to fix it? Thanks in advance.

Solved: thanks guys, I just place my jquery at the bottom and it fix the problem.

like image 485
tipsywacky Avatar asked Feb 17 '13 08:02

tipsywacky


4 Answers

for others who have the same problem, in my situation the delay was from autofocus="" attribute in the text input, so I removed that and the problem solved!

hope this helps

like image 131
Homayoon Ahmadi Avatar answered Sep 21 '22 03:09

Homayoon Ahmadi


I would suggest the following :-

  1. Remove any jquery from header and place it to the bottom of the page .

  2. Remove excess white space from your coding.

  3. Reduce the size of your images files.

  4. Try to combine many scripts into one if possible.

  5. Remove any unnecessary elements .

  6. Combine all style sheets into one - lesser files , lesser response time and faster loading time.

  7. Optimize your background image or any image you are using on the page for faster loading.

  8. In the end use Gzip to minify JS , CSS and HTML . Never use it on images,videos,pdf's - wont do any additional compression ,but might increase the size .

like image 29
Shail Avatar answered Sep 17 '22 03:09

Shail


Just one LINK element or SCRIPT element inside a document's HEAD element will prevent a flash of unstyled content.

like image 20
Floris Avatar answered Sep 19 '22 03:09

Floris


Put a script tag with 0 inside the head

<head>
    <!-- Other head stuff ... -->
    <script>0</script>
</head>
like image 44
CarlThePerson Avatar answered Sep 19 '22 03:09

CarlThePerson