Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
748 views
in Technique[技术] by (71.8m points)

css - -webkit-filter: drop-shadow for other browsers

I have a drop shadow effect that I am applying using the following css:

-webkit-filter: drop-shadow(0 1px 10px rgba(113,158,206,0.8));

Does anyone know what the equivalent for this is for the other browsers.

Please note I can't use box-shadow: 0 1px 10px rgba(113,158,206,0.8) as this won't apply the shadow effect around the css arrow part of the shape

Fiddle

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ok I have figured this out - the equivalent for opera and firefox is:

filter: url(drop-shadow.svg#drop-shadow);

where drop-shadow.svg looks like this:

<svg height="0" xmlns="http://www.w3.org/2000/svg">
 <filter id="drop-shadow">
    <feGaussianBlur in="SourceAlpha" stdDeviation="2.2"/>
    <feOffset dx="1" dy="4" result="offsetblur"/>
    <feFlood flood-color="rgba(0,0,0,0.3)"/>
    <feComposite in2="offsetblur" operator="in"/>
    <feMerge>
      <feMergeNode/>
      <feMergeNode in="SourceGraphic"/>
    </feMerge>
  </filter>
</svg>

IE being so crap doesn't support the svg values feOffset, feFlood or feMerge so doesn't currently have an equivelant

I'll leave this open in-case anyone figures out how to do this effect for IE

UPDATE

Thanks to psdie for finding this post

IE Version:

-ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=1, Color='#444')";
filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=1, Color='#444')";

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...