pie.htc的使用----使IE6/7/8兼容部分CSS3属性

一、前言

pie.htc是一个可以解决IE6/7/8无法支持CSS3属性的文件,其利用VML绘制相关的效果。要注意的是它并不能实现所有CSS3效果,其兼容的属性有:box-radius,线性渐变( linear-gradient),rgba,box-shadow,border-image。

二、使用方法

使用behavior:url(pie.htc)引入pie.htc即可完成相关效果了。以下实例均使用IETester进行测试,主要测试IE6/7/8的效果。

(1)圆角(border-radius)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .demo{
            height: 100px ;
            width:200px;
            border:1px solid #00FFFF;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            behavior: url(static_resources/PIE.htc);
        }
    </style>
<body>
    <div class="demo"></div>
</body>
</html>

(2)盒阴影(box-shadow)

.demo{
    height: 100px ;
    width:200px;
    background: #00FFFF;
    -webkit-box-shadow: 10px 10px 5px #888888;
    -moz-box-shadow: 10px 10px 5px #888888;
    box-shadow: 10px 10px 5px #888888;
    behavior: url(static_resources/PIE.htc);
}

(3)RGBA

.demo{
    height: 100px ;
    width:200px;
    background: rgba(0,0,0,0.5);
    -pie-background:rgba(0,0,0,0.5);
    behavior: url(static_resources/PIE.htc);
}

(4)border-image(IE6/7/8只会以stretch的形式进行填充,即使border-image-repeat属性是repeat和round)

.demo{
    height: 100px ;
    width:200px;
    border:15px solid transparent;
    -webkit-border-image: url(img/border.png) 30 30 round;
    -moz-border-image: url(img/border.png) 30 30 round;
    -o-border-image: url(img/border.png) 30 30 round;
    border-image: url(img/border.png) 30 30 round;
    behavior: url(static_resources/PIE.htc);
}

Chrome下的效果

IETester下的效果

(5)background-size(针对兼容background-size使用了backgroundsize.htc,支持IE7/8,无法支持IE6)

.demo{
    height: 100px ;
    width:200px;
    background-image: url("img/1.jpg");
    background-size: cover;
    behavior: url(static_resources/backgroundsize.min.htc);
}

(6)Gradient背景渐变(支持线性渐变)

.demo{
    height: 100px ;
    width:200px;
    background:linear-gradient(90deg,#00FFFF,#0000FF);
    -pie-background:linear-gradient(0,#00FFFF,#0000FF);
    behavior: url(static_resources/PIE.htc);
}

三、下载地址

pie.htc下载地址:css3pie

backgroundsize.htc下载地址:backgroundsize.htc

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MAXLZ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值