页面中 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
投稿

猜你喜欢

  • WEB页面工具语言XML应用分类之运用

    2008-05-29 10:58:00
  • Javascript 小游戏,“是男人坚持 100 次”

    2009-01-22 14:25:00
  • 用CSS实现图片等比例缩放

    2008-01-18 21:10:00
  • 白鸦:贪守米缸者,饿死灶台

    2009-02-23 13:03:00
  • XHTML1.0与HTML兼容指引16条[译]

    2009-06-10 14:45:00
  • 让SQL Server数据库自动执行管理任务(一)

    2009-03-20 10:35:00
  • 作为Web开发人员,我为什么喜欢Google Chrome浏览器

    2011-08-29 15:37:47
  • mysql 获取表有多少列

    2010-10-14 13:44:00
  • oracle 触发器 学习笔记

    2009-05-24 19:57:00
  • 我的css样式写法总结

    2009-01-18 13:04:00
  • asp如何判断偶数和奇数?

    2010-01-12 20:16:00
  • asp 网站静态化函数代码html

    2011-03-16 11:21:00
  • 不错的广告定位效果代码

    2009-06-05 18:51:00
  • 网站LOGO设计规范的思考--1.设计基础

    2007-10-14 10:55:00
  • SQL Server 2005实现数据库缓存依赖

    2009-05-07 13:20:00
  • Atlas—微软的Ajax工具包

    2007-09-07 09:52:00
  • 在ASP应用程序中加入智能搜索

    2007-09-18 13:15:00
  • Oracle时间日期操作方法小结

    2010-11-25 18:04:00
  • 可输入的select代码

    2009-12-26 18:25:00
  • 简约的实现——服装网站设计

    2009-03-06 12:43:00
  • asp之家 网络编程 m.aspxhome.com