正在阅读:

CSS3实现阴影效果(兼容所有浏览器)

作为前端开发人员都知道,css实现阴影效果一般很难兼容IE浏览器,标准的代码就是:

.shadow {
    -moz-box-shadow: 3px 3px 4px #000;
    -webkit-box-shadow: 3px 3px 4px #000;
    box-shadow: 3px 3px 4px #000;
}
释义为:横向偏移3像素,纵向偏移3像素,模糊4像素,颜色为纯黑。
但是以上代码对于IE浏览器来讲,是没有任何效果的,所以在IE中我们应该加上如下代码:
.shadow {
    /* For IE 8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.Shadow
   (Strength=4, Direction=135, Color='#000000')";
    /* For IE 5.5 - 7 */
    filter: progid:DXImageTransform.Microsoft.Shadow
   (Strength=4, Direction=135, Color='#000000');
}
结合以上代码,兼容各大浏览器的CSS代码如下:
.shadow {
    -moz-box-shadow: 3px 3px 4px #000;
    -webkit-box-shadow: 3px 3px 4px #000;
    box-shadow: 3px 3px 4px #000;
    /* For IE 8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.Shadow
   (Strength=4, Direction=135, Color='#000000')";
    /* For IE 5.5 - 7 */
    filter: progid:DXImageTransform.Microsoft.Shadow
    (Strength=4, Direction=135, Color='#000000');
}

目前有:119条访客评论

  1. Jeffreylef
    2018-09-28 12:40

    how much is viagra online
    viagra pills
    buy viagra online from canada
    [url=http://viagrakst.com/#]generic viagra prices[/url]
    sildenafil price

  2. NathanRag
    2018-09-28 12:38

    puedo comprar viagra por internet
    viagra online
    illegal buy viagra street
    [url=http://viagrakst.com/#]buy viagra online[/url]
    viagra buy durban

  3. GregoryLabax
    2018-09-28 11:51

    buy viagra from pfizer
    cheap viagra
    buy viagra online us no prescription
    [url=http://viagrakst.com/#]generic viagra 100mg[/url]
    buy real viagra online cheap

  4. Kevinorine
    2018-09-28 10:58

    sildenafil generico guatemala
    viagra online
    20mg levitra vs 100mg viagra
    [url=http://viagrakst.com/#]viagra pills[/url]
    viagra sale amazon

  5. TysonKal
    2018-09-24 20:50

    cialis viagra sale
    cheap viagra
    effet du viagra 100mg
    [url=http://viagrakst.com/#]generic viagra available[/url]
    buy viagra auckland

  6. AndreTem
    2018-09-24 12:37

    jelly viagra online
    buy viagra online
    sildenafil cost per pill
    [url=http://viagrakst.com/#]cheap viagra[/url]
    a quando il viagra generico

  7. Tracyseilm
    2018-09-24 11:32

    identifying viagra pills
    buy viagra online
    buy viagra pfizer online
    [url=http://viagrakst.com/#]generic viagra 100mg[/url]
    can you buy viagra over the counter in south africa

  8. Thomasatowl
    2018-09-24 11:13

    where to get viagra online
    buy viagra online
    genericos do viagra ems
    [url=http://viagrakst.com/#]buy viagra online[/url]
    omg viagra

  9. Keithwew
    2018-09-23 00:44

    citrato de sildenafil 25mg
    online viagra
    where can i get viagra in bangalore
    [url=http://viagrakst.com/#]buy viagra[/url]
    wie wirkt viagra 100mg

留下脚印,证明你来过。

*

*

流汗坏笑撇嘴大兵流泪发呆抠鼻吓到偷笑得意呲牙亲亲疑问调皮可爱白眼难过愤怒惊讶鼓掌