Rule 5: Put Stylesheets at the Top(Chapter 5 of High performance Web Sites)

      Frontend engineers who care about performance want a page to load progressively;
that is, we want the browser to display whatever content it has as soon as possible.
This is especially important for pages with a lot of content and for users on slower
Internet connections.The importance of giving users visual feedback has been well
researched and documented.
Here are the cases where putting stylesheets at the bottom of the document causes
the blank white screen problem to surface in Internet Explorer:
      In a new window
      Clicking the “new window” link in the example page opens “CSS at the Bottom”
in a new window.Users often open new windows when navigating across
sites, such as when going from a search results page to the actual target page.
      As a reload
      Clicking the Refresh button, a normal user behavior, is another way to trigger a
blank white screen.Minimize and restore the window while the page is loading
to see the blank white screen.
      As a home page
      Setting the browser’s default page to http://stevesouders.com/hpws/css-bottom.php
and opening a new browser window causes the blank white screen.Rule 5 is
important for any team that wants its web site to be used as a home page.

      To avoid the blank white screen, move the stylesheet to the top in the document’s
HEAD.Doing this in the sample web site I’ve called “CSS at the Top” solves all the
problem scenarios.No matter how the page is loaded—whether in a new window, as
a reload, or as a home page—the page renders progressively.
      There are two ways you can include a stylesheet in your document: the LINK tag and
the @import rule. An example LINK tag looks like this:
      <link rel="stylesheet" href="styles1.css">
      This is an example of a STYLE block with an @import rule:
      <style>
      @import url("styles2.css");
      </style>

转载于:https://www.cnblogs.com/zhtf2014/archive/2009/10/12/1582088.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值