The mask feature is not functioning properly in Internet Explorer

Hello everyone, I'm attempting to blur the edges of an image from one side only using the mask property so that the background of the body tag blends with the image. Take a look at the example image below.

I've tried implementing it as demonstrated in this link, and it works perfectly on all browsers except for IE and Opera. It seems like many blogs mention that the masking property doesn't work well with IE. Below is the snippet of my code:

<svg  width="503" height="373">
    <defs>
        <filter id="filter">
            <feGaussianBlur stdDeviation="10" />
        </filter>
        <mask id="mask">
            <rect y="0" height="400" width="300" fill="white" filter="url(#filter)" ></rect>
        </mask>
    </defs>
    <image xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/Harry-Potter-1-.jpg" width="503" height="373" mask="url(#mask)"></image>
    <foreignObject width="503px" height="373px" style="mask: url(#mask);"></foreignObject>
</svg>

If masking isn't the best solution for achieving this effect, please suggest alternative solutions. Thank you.

Answer №1

After some thought, I believe I have found a way to make it work for IE. You can view the solution on this Fiddle

 <svg xmlns="http://www.w3.org/2000/svg" width="300" height="200>
      <defs>
        <linearGradient id="gradient1" spreadMethod="pad" x1="0%" y1="0%" x2="100%" y2="0%">
          <stop stop-color="#ffffff" stop-opacity="1" offset="70%" />
          <stop stop-color="#000000" stop-opacity="1" offset="100%" />
        </linearGradient>
        <mask id="mask4" x="0" y="0" width="300" height="200">
          <rect style="fill: url(#gradient1); stroke: none;" x="0" y="0" width="200" height="200" />
        </mask>
      </defs>
      <image mask="url(&quot;#mask4&quot;)" width="300" height="200" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/Harry-Potter-1-.jpg" />
    </svg>

Answer №2

If you want a clean and professional look for your photos, consider using Photoshop to edit them instead of relying on masking techniques. By doing so, the image will be rendered directly by browsers without the need for CSS adjustments. Fortunately, there are plenty of online tutorials available to guide you through the photo editing process in Photoshop.

Another option is to explore a workaround suggested by Martin Beeby, although it may appear complex at first glance.

Wishing you success with your editing endeavors!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combine numerous CSV files (in the appropriate sequence) into a single chart

I am looking to load multiple CSV files and display the data on a line chart. I have successfully loaded and displayed one CSV file on a line chart. Here is an example of my CSV file: Date,PV,Energy 1355100420,0.000,0.851 1355100480,0.000,0.841 135510054 ...

Reveal Visual Content upon Hovering

Is there a way to show an image only when the mouse hovers over it? Additionally, can we underline the adjacent text at the same time? If the mouse moves away from the image, I'd like it to hide again and revert the text back to its original state. T ...

Is it recommended to apply a FLOAT attribute to DIV elements with a width of 100%?

Currently, I have a page with five stacked DIVs in a vertical layout. I am wondering if it is necessary to apply the FLOAT property to each DIV to adhere to good coding practices. It appears that there are no issues, such as re-wrapping, in any browser e ...

The Bootstrap modal window refuses to shut down

In my React application, I am utilizing Bootstrap modal functionality. One specific requirement is that the modal window should remain open when clicking on the modal backdrop. To achieve this, I have implemented the following code: $(".modal").modal({"ba ...

Retrieve Object Key in Angular 7

I have a specific item: this.item = { name:"Michael", age:18 }; I am looking to display it in an HTML format. name: Michael age: 18 <div >{{ item (name) }}</div> --??? should put name <div>{{ item.name }}</div> < ...

Dealing with an AngularJS application that needs to handle a JSON object containing numerous levels of nesting and unpredictable data values

I am facing a challenge where I need to call a service that will return a JSON object with an unpredictable number of parents, children, grandchildren, etc., all having unknown names. Having limited experience with recursion from my college days, I am s ...

Achieving image-text alignment within a while loop becomes more complex as additional components are added during each iteration

I need help organizing my text and images to display properly on the page. Currently, I have code that displays text and image to the right of each other, but as the loop iterates, it keeps adding more text and images next to the original set. Because I ...

AngularJs-elasticSearch: changes not reflected on the page

As someone who is still new to Angular and elasticSearch, my aim is to enter a new tweet, then upon clicking the add button, the tweet will be indexed in Elasticsearch and a table displaying the results of tweets will be updated. Here is the HTML code: &l ...

Tips for creating a fluid layout in Bootstrap 3 that avoids horizontal scrollbars

Check out this link for a sample: This is the HTML I am using. <div class="row"> <div class="col-md-6">.col-md-6</div> <div class="col-md-6">.col-md-6</div> </div> Bootstrap 3 does not have container-fluid and row ...

Steps for deactivating tab stops on the primary webpage in the presence of a snackbar

On my web page, there are multiple drop-down menus, input fields, and buttons that can be interacted with using both the tab key and mouse. After entering certain data, I trigger a snackbar (source: https://www.w3schools.com/howto/howto_js_snackbar.asp) t ...

Enable erase functionality for touchscreen interactions (TouchEvent)

I have created a fun game where players must erase a colored layer to reveal an image. However, I am facing an issue as the game only works on my desktop and not on touchscreens like iPhones or iPads. I believe I need to replace MouseEvent with TouchEvent, ...

Addressing the space discrepancy between the div element and the footer segment

I'm facing some issues with the layout of my DIVs. There seems to be a large gap between my divs and the footer in this example. How can I make the divs line up right underneath the footer? Another problem is that box 2,3,4 don't seem to have a ...

How can I ensure that my SVG Image perfectly fits within the Parent wrapper div?

I've been grappling with the following code snippet. I'm struggling to make my SVG image fit within my container div. .img { margin: 0; padding: 0; overflow: hidden; width: 500px; position: relative; } img { top:0; ...

The fadeOut() method causing issues with the visibility property

I am currently working on a feedback page that is displayed in a table with 3 columns. Name Feedback icons status ------------------------------------------------- Name1 icon1 icon2 icon3 Saved Name2 icon1 icon2 icon3 ...

Unable to get scroll snapping to function properly on Windows and various other devices

My webpage has scroll snapping enabled, which works well on Mac but not on certain devices (especially Windows), where it behaves like a regular scroll. This makes it difficult for visitors to read the content as they have to manually figure out where each ...

Can someone help me understand how to change the structure in order to identify which class has a body?

I have a small example to share with you: link HTML CODE: <div class="body"> <div class="test">TEST</div> </div> JS CODE: switch (className) { //instead of n, I need to write className case body: alert("my cla ...

font-family: code, code

Within the normalize.css file, there are rules for monospace fonts that include: font-family: monospace, monospace; How does this differ from just using: font-family: monospace; Could there be a specific reason for this? Perhaps it serves as a workaround ...

Tips on maximizing the file size limit of the fileupload control in asp.net

I am trying to determine the file size limit for my file upload control. Below is the HTML code snippet: <input id="uplTheFile" style="WIDTH: 318px; HEIGHT: 22px" type="file" size="80" name="uplTheFile" runat="server"> I have checked the code but ...

Using jQuery to follow a div while scrolling that halts at a designated top or bottom boundary

I've been working on this jsfiddle: https://jsfiddle.net/3ncyxnzt/ Currently, the red box stops at a specified margin from the top of the page but I want it to also stop before reaching the bottom, so that it doesn't go under or over the footer. ...

What are some other ways to include multiple HTML "submit" buttons within a form?

I am developing an app to simplify the process of writing contracts. You can check it out here: Instead of having one submit button to insert data for both contracting parties, I am looking to have separate buttons for the first and second party. This way ...