css加载迟到,所以html看起来怪异一秒 [英] css loads late, so html looks weird for a second

查看:384
本文介绍了css加载迟到,所以html看起来怪异一秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个常见的问题,我有一个使用HTML,CSS和JQuery的网页。当页面开始加载时,它首先加载html并显示一秒钟的div,它们应该被css和jquery隐藏。但一秒钟后,它看起来完美。但是第一秒看起来很可怕。如何避免这种情况?

I have a common question, I have a webpage done with HTML,CSS and JQuery. When the page starts loading, It first loads the html and displays divs for a second which are supposed to be hidden by css and jquery. But after a second, it looks perfect. But that first second looks terrible. How can I avoid that?

推荐答案

我没有这样的经验,但我认为脚本的加载过程应该帮助这里。

I've not had such an experience but I think the loading procedure for your scripts should help here. Depending on what the page is meant to do (unknown to me), I prefer you try loading this way.

使用CSS显示div

Display the div using CSS

<div style="display: none;">Hidden by default</div>

在关闭body标记之前加载您的JQuery文件。

Load your JQuery files before the closing of your body tag.

当页面完全加载后,它可以正常工作。

When page is fully loaded it can then function well.

这篇关于css加载迟到,所以html看起来怪异一秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆