阿彌陀佛

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

IE6,7并不支持CSS3的属性,IE8也不能很好的支持CSS3。如何让ie支持border-radius (rounded), box-shadow ( shadow), text-shadow等这些属性呢?这里介绍一个通过htc脚本实现这些属性的方法。

首先下载ie-css3.htc脚本。

然后在css中加入 behavior: url(ie-css3.htc);

.box {
  -moz-border-radius: 15px; /* Firefox */
  -webkit-border-radius: 15px; /* Safari and Chrome */
  border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */

  -moz-box-shadow: 10px 10px 20px #000; /* Firefox */
  -webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
  box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */

  behavior: url(ie-css3.htc); /* This lets IE know to call the script on all elements which get the 'box' class */
}
 

注意: behavior: url(ie-css3.htc) 中的ie-css3.htc地址用绝对路径或者直接传到网站的根目录下面,要不然可能会看不到效果的。

官方介绍:CSS3 support for Internet Explorer 6, 7, and 8

另有一篇跨浏览器实现圆角的文章,有兴趣可以看一下,原理相同。Curved corner (border-radius) cross browser

posted on 2011-05-10 14:05  阿彌陀佛  阅读(202)  评论(0)    收藏  举报