How can I make the Blur effect on IE?

Asked

Viewed 248 times

6

I’m using this css code to do the effect blur in a div:

.blur
{
    -webkit-filter: blur(25px);
    -moz-filter:    blur(25px);
    -o-filter:      blur(25px);
    -ms-filter:     blur(25px);
    filter:         blur(25px);
}

<div class="blur">
    <!-- HTML code -->
</div>

The problem is that the Iexplorer browsers do not support filter effects.

How can I do this effect on IE? Is there any alternative?

2 answers

1

As you gave few details I will reply with a simple option. It may be that this option does not work for all cases, but it is an alternative since we do not have too many details.

Option 1: Using box-shadow. note that this is a property already very well accepted by browsers, even the oldest! It works from I9+ https://caniuse.com/#feat=css-boxshadow

Option 2: Using SVG. Note that the SVG is well accepted even by the IE from version 9 as you can check here https://caniuse.com/#feat=svg

image taken on IE11

inserir a descrição da imagem aqui

Follow the code referring to the image above.

The option with box-shadow was made nothing more than an element with several box-shadows superimposed. In older ies if it does not accept more than one box-shadow you can superimpose the whole element on each other with position:absolute

The SVG simply uses the Filter <feGaussianBlur in="SourceGraphic" stdDeviation="5" />. You can do as in the first example with the filter only in the rect or rect and in the text giving the impression that everything is with blur

body {
    margin: 10px 0 0 40px;
    display: flex;
}
.box {
    width: 115px;
    height: 115px;
    background-color: red;
    top: 10px;
    position: relative;
}
.box.bs {
    box-shadow: 
    0px 0px 8px 0px red, 
    0px 0px 8px 0px red, 
    0px 0px 8px 0px red, 
    0px 0px 8px 0px red
}

div {
    margin-right: 30px;
}
<div>
    <p>DIV com box-shadow</p>
    <div class="box bs" >123</div>
</div>

<div>
    <p>DIV com filtro</p>
    <div class="box" style="filter:blur(2px); width:120px; height: 120px">123</div>
</div>

<div>
    <p>SVG com defs filter</p>
    <svg height="140" width="140">
        <defs>
            <filter id="f1" >
                <feGaussianBlur in="SourceGraphic" stdDeviation="2" />
            </filter>
        </defs>
        <rect x="10" y="10" width="120" height="120"  fill="red" filter="url(#f1)" /> 
        <text x="10" y="25" fill="black">123</text>
    </svg>
</div>
<div>
    <p>SVG com defs filter em tudo</p>
    <svg height="140" width="140">
        <defs>
            <filter id="f1" >
                <feGaussianBlur in="SourceGraphic" stdDeviation="2" />
            </filter>
        </defs>
        <rect x="10" y="10" width="120" height="120"  fill="red" filter="url(#f1)" /> 
        <text filter="url(#f1)" x="10" y="25" fill="black">123</text>
    </svg>
</div>

  • What details do you need to know?

  • @Jorgeb. in case it would be if you wanted to apply the Blur only in the background for example, or in an element set, like a div and everything that is inside it. However I tried to give examples that would meet both situations. Even with more than 2 years of delay in the answer I hope I can still help someone :)

  • Can you help me, that I still have no such effect when it’s for ie. When you have a little time I’ll test this.

  • 1

    @Jorgeb. cool, test there and see if it works! In the test I did in IE 11 was good! What doubt you want to give me a touch that I help you.

0

  • 1

    It doesn’t work, because it’s not the effect for an image, it’s for a div HTML.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.