页面中 CSS 加载方式的优化

作者:blank 来源:怿飞博客 时间:2008-03-26 12:36:00 

1、应该将 CSS 放置于结构的上方(一般放置于 head 元素内)。CSS 是解释型语言,Firefox 和 IE 在等待 CSS 传输完成之前不会渲染任何东西。只有将 CSS 前置,才可在浏览器解析结构时,对页面进行渲染。

This causes the blank white screen problem. The page is totally blank until the stylesheet at the bottom is downloaded, on the order of 6-10 seconds for this page. The browser is waiting for the stylesheet to be loaded before it renders anything else in the page, even the static text.

导致的问题就是,页面会有一段时间“朴素”,突然之间又“华丽”,用户体验很不好。

2、尽量使用 <link rel=”stylesheet” href=”http://www.planabc/yuanxin.css” type=”text/css”> 的样式导入方式,而减少 @import 的使用,更勿使用多层嵌套的 @import 。因为在 IE 里, @import 相当于将 <link> 放在页面尾部。

This is a valid syntax, but, even though it’s in the document’s HEAD, it breaks progressive rendering and instead causes the blank white screen and Flash of Unstyled Content problems.

扩展阅读:

标签:加载,css,浏览器,效率
0
投稿

猜你喜欢

  • 如何获知用户的IP?

    2009-11-24 20:52:00
  • 在import scipy.misc 后找不到 imsave的解决方案

    2023-08-09 05:21:45
  • Python一句代码实现找出所有水仙花数的方法

    2021-10-09 08:10:44
  • 发个js从样式表取值的函数

    2008-05-20 12:23:00
  • 人工智能深度学习OpenAI baselines的使用方法

    2022-03-02 22:40:47
  • NumPy 基本切片和索引的具体使用方法

    2023-02-11 20:47:50
  • Python常用Web框架Django、Flask与Tornado介绍

    2021-06-24 18:19:35
  • MySQL学习之数据库操作DML详解小白篇

    2024-01-14 11:59:48
  • JMeter对MySQL数据库进行压力测试的实现步骤

    2024-01-28 18:26:55
  • javascript判断图片是否加载完成的方法推荐

    2024-05-29 22:12:05
  • python登录pop3邮件服务器接收邮件的方法

    2021-09-21 18:05:15
  • Python自动化办公之Word文件内容的读取

    2021-04-06 18:18:18
  • 使用Python中的greenlet包实现并发编程的入门教程

    2023-10-18 08:29:00
  • python3新特性函数注释Function Annotations用法分析

    2023-08-09 20:15:29
  • asp将table生成excel文件(xls)

    2011-03-07 11:17:00
  • MySQL实现分页查询的方法

    2024-01-17 13:52:32
  • Python pip安装第三方库实现过程解析

    2022-01-04 02:17:31
  • pygame 键盘事件的实践

    2023-09-29 18:56:10
  • 基于Python+Pygame实现变异狗大战游戏

    2021-04-19 09:46:45
  • 解决微信浏览器缓存站点入口文件(IIS部署Vue项目)

    2024-05-13 10:40:00
  • asp之家 网络编程 m.aspxhome.com