当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > 优化CSS在网页中的加载方式

CSS样式表
CSS3教程(10):CSS3 HSL声明设置颜色
CSS3教程:新增加的结构伪类
网页布局绝对定位(position)轻松简单
掌握盒模型轻松DIV CSS网页布局
实例方式学CSS text-align怎么用
网页重构时在IE6中遇到png兼容性
CSS3教程:边框属性border的极致应用
CSS网页布局使用表格可以吗?
最新版本的CSS选择器浏览器支持情况
有序列表和段落设计华丽的网页列表数字
CSS教程:通过实例学习和理解CSS盒模型
CSS网页布局的核心内容:CSS盒模型
CSS3伪类选择器:nth-child()
CSS教程:inline-block在各浏览器的显示
CSS实现网页分栏布局的方法:绝对定位和浮动
CSS实例:用CSS制作网页像素画
CSS教程:三列固定网页布局实例
无hack无js全兼容text-overflow-ellipsis效果
CSS解决方案:IE6中遇到png兼容性
CSS学习之类目之间竖线的练习实例

CSS样式表 中的 优化CSS在网页中的加载方式


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 82 ::
收藏到网摘: n/a


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.

扩展阅读:     《Flash of Unstyled Content (FOUC)》