---
title: "FOUC 文档样式闪烁"
author: "小丑鱼0703"
date: "2015-03-02T15:23:59Z"
tags: []
categories: ["Web前端"]
slug: "fouc"
draft: false
lastmod: "2015-03-02T15:23:59Z"
id: 2187970
url: "https://wangjingyi.iteye.com/blog/2187970"
---

**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标签

```java
<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标签

```java
<head>
<title>My Page</title>
<script type="text/javascript"> </script>
<style type="text/css" media="screen">@import "style.css";</style>
</head>
```