How to load css3 pie only for ie7 and 8? But not for 9

牧云@^-^@ 提交于 2019-12-01 11:14:30

behavior is not a valid CSS property and will be ignored by browsers other than Internet Explorer. They will not download the PIE.htc file.

You mention you cannot load in conditional comment, but if you can use conditional comments (?), then you can do the following trick:

<!doctype html>
<!--[if IE 7]><html class="ie7"><![endif]-->
<!--[if IE 8]><html class="ie8"><![endif]-->
<!--[if gt IE 8]><!--><html><!--<![endif]-->
<head>

In this case you are using conditional comments, but you are not loading anything inside the comments. You are merely adding a browser-specific class to the <html>-element. Now you can do this in your CSS:

.some-class {
  border-radius: 12px;
}
.ie7 .some-class, .ie8 .some-class {
  behavior: url(/PIE.htc);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!