`

FOUC 文档样式闪烁

 
阅读更多
FOUC--Flash Of Unstyled Content (文档样式闪烁)

http://www.bluerobot.com/web/css/fouc.asp/中是这么定义的:
What is a FOUC?
Some pages that use the CSS @import rule experience a curious display quirk in the Windows version of MS Internet Explorer: a momentary flash of unstyled page content.
简而言之,指当一些页面以 CSS @import 方式引用样式加载页面的时候,IE浏览器出现短暂样式失效。


http://zhangyaochun.iteye.com/blog/1701113这里有详细的说明。
Just one LINK element or SCRIPT element inside a document's HEAD element will prevent a flash of unstyled content.在head里面加入一个link或者script标签就可轻松解决啦~如下所示:

LINK element solution:页面head标签里面使用link标签
<head>
<title>My Page</title>
<link rel="stylesheet" type="text/css" media="print" href="print.css">
<style type="text/css" media="screen">@import "style.css";</style>
</head>


SCRIPT element solution:页面head标签里面使用script标签
<head>
<title>My Page</title>
<script type="text/javascript"> </script>
<style type="text/css" media="screen">@import "style.css";</style>
</head>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics