@fengfeng
2014-09-19T03:03:19.000000Z
字数 789
阅读 1473
IE条件注释
条件注释会阻塞页面的下载,直到css文件都下载了,才继续下载;
block further downloads until the css files are fully downloaded, hence increasing load time
例如:
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet href="1.css">
<!‐‐[if IE 6 ]>
<link type="text/css" rel="stylesheet" href="ie.css">
<![endif]‐‐>
</head>
...
解决方法:在所有的css之前写一个空的条件注释 from1 from2
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<link type="text/css" rel="stylesheet href="1.css">
<!‐‐[if IE 6 ]>
<link type="text/css" rel="stylesheet" href="ie.css">
<![endif]‐‐>
</head>
...
<!DOCTYPE html>
<html>
<head>
...
</head>
<!‐‐[if IE 6]><body class="ie6"><![endif]‐‐>
<!‐‐[if !IE]><!‐‐><body><!‐‐<![endif]‐‐>
...
解决方法:把条件注释的class提前放到html上,不要放body上 from2
<!DOCTYPE html>
<!--[if IE6]><html class="ie6"><![endif] -->
<!--[if !IE]><!--><html><!--<![endif]-->
<head>
...
</head>
<body>
...