1秒的CSS延迟HTML页面加载? [英] 1 second of delay of css on html page load?
问题描述
我一直在尝试制作一些HTML和CSS页面.每次加载页面时.它总是给我大约一半的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.
已解决:谢谢,我只是将我的jquery放在底部,它可以解决问题.
Solved: thanks guys, I just place my jquery at the bottom and it fix the problem.
推荐答案
我建议以下内容:-
-
从标题删除所有jquery并将其放置在页面底部.
Remove any jquery from header and place it to the bottom of the page .
从编码中删除多余的空格.
Remove excess white space from your coding.
减小图像文件的大小.
如果可能,请尝试将许多脚本组合成一个脚本.
Try to combine many scripts into one if possible.
删除所有不必要的元素.
Remove any unnecessary elements .
将所有样式表合并为一个文件-更少的文件,更少的响应时间和更快的加载时间.
Combine all style sheets into one - lesser files , lesser response time and faster loading time.
优化背景图像或页面上正在使用的任何图像,以加快加载速度.
Optimize your background image or any image you are using on the page for faster loading.
最后使用Gzip缩小JS,CSS和HTML.永远不要在图像,视频,pdf上使用它-不会做任何其他压缩,但是可能会增加大小.
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 .
这篇关于1秒的CSS延迟HTML页面加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!