Strange anomaly occurs when resizing and blurring an image on Chrome

I've been experimenting with a CSS effect that combines zooming and blurring. The idea is that when I hover over an image, it should blur out and scale slightly, all while being contained within a div with overflow:hidden.

However, when testing in Chrome, I noticed a strange glitch. A blurry white border appears around the container during the transition.

I'm curious if there's a better approach to achieve this effect or a workaround for the issue. Any insights would be greatly appreciated!

You can view a gif that illustrates the problem here: https://i.sstatic.net/o3a8W.jpg

And here's the same code running in Firefox for comparison: https://i.sstatic.net/1008t.jpg

Take note of the borders visible within the image.

Below is the CSS code I am using:

<style>
#img0{
    width:500px;
    height:auto;
}
.hoverBlur{
    -webkit-transition:all 0.5s ease;
    -moz-transition:all 0.5s ease;
}
.hoverBlur:hover{
    -webkit-transform:scale(1.1);
    -moz-transform:scale(1.1);
    transform:scale(1.1);

    -webkit-filter:blur(15px);
    -moz-filter:blur(15px);
    filter:blur(15px);

}
.container{
    margin:200px;
    width:500px;
    height:333px;
    border:1px solid #ccc;
    overflow:hidden;
}
</style>
<div class="container">
    <img id="img0" src="test.jpg" class="hoverBlur"/>
</div>

Answer №1

Although this thread is ancient, I encountered the same issue and have not been able to find a solution posted elsewhere, so I am sharing it here:

To resolve this problem, you can add a margin to the image that matches the blur size (15px in this case) and then use transform: translate to position the image correctly.

https://jsfiddle.net/abxyzh3c/

In our scenario, an image with a blur(15px) effect is used. To fix it, apply the following CSS to the image:

img {
    ...
    margin: 15px;
    transform: translate(-15px, -15px);
}

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

The background hue contracts as the window size changes

I am encountering an issue. The appearance of my page is not matching what I had envisioned. *{margin:0; padding:0;} .width{width:980px;margin:0 auto;} .header{width:100%;background-color:#ffffbb;} .leftpanel{float:left;height:50px;} .rightpanel{float:r ...

CSS - Incorporate the value of the counter() function as a property value

Is it possible to increment the margin-top of an element based on its index using a counter()? For example: div { margin-top: calc(counter(myCounter) * 10px); } I couldn't find any information on whether this is achievable or not. Since counters ...

Utilize the Step Function in Jquery to create animated rotation at a specific degree angle

I have a div that is currently rotated at -35 degrees (as set in the CSS file). I would like to be able to click on it so that it rotates back to 0 degrees. Here is the code from my Javascript file: $("div#words").on("click",function(e){ $(this).anim ...

Developing an adaptive image for a specific segment

I've been racking my brain trying to figure out what obvious mistake I made on this basic website. I need the image below the header to be responsive, but no matter what I try, it just won't cooperate. If someone could help me out, I would reall ...

Ways to correct the issue of multiple <div>s overlapping each other after being rotated by 90 degrees

Can someone assist me with rotating multiple divs without them overlapping? Below is a simplified version of my code: <div> <div class="rect"></div> <div class="rect"></div> <div class="rect"></div> & ...

HTML Scroll Blocking

Recently, I have been working on designing the mobile version of a website. However, I noticed that when I try to scroll quickly on my phone, the scrolling gets interrupted and I have to wait for it to catch up. I am using the fullpage.js library in this ...

Increase the size of a button using CSS styling

Looking for guidance on extending the length of a button in HTML code? Take a look at this snippet: <span class="xp-b-submit xp-b-submit-btn xp-b-right"> <a href="#" class="xp-t-bold" id="PostSubmitLink">Post Search</a> </span> ...

Retrieve unique elements from an array obtained from a web API using angular brackets

I've developed a web application using .NET Core 3.1 that interacts with a JSON API, returning data in the format shown below: [ { "partner": "Santander", "tradeDate": "2020-05-23T10:03:12", "isin": "DOL110", "type ...

Anime.js: Grid layout causing issues with displaying simple text animations

I'm attempting to create a text animation within a grid layout using the anime.js library, but unfortunately, the animation isn't displaying. The project consists of just one HTML file. The JavaScript code: <script> import anime from &ap ...

Modifying the Navbar Border Color in Bootstrap 4 - A Step-by-Step Guide

Changing the navbar color in Bootstrap 3 is done by adjusting the .navbar-light border-color. However, in Bootstrap 4 this method does not produce the desired effect. ...

Using jQuery to showcase JSON information in an HTML format

I was looking for a straightforward way to showcase text and its author in HTML, similar to this format: text: You can observe a lot just by watching author: Yogi Berra Despite my best efforts with jQuery, the result on the screen is blank and undefin ...

How can I transfer CSS styles from one class to another using JQuery?

Is it possible for me to create a timepicker that matches the style of the datepicker in the current UI Theme? I am looking to replicate the CSS properties from the datepicker for my timepicker without copying any behavioral aspects. (Although there are o ...

Html flipcard malfunctioning and logo overlapping issue detected

Regarding the following code: <html> <style> .img { max-width: 100%; } .Headerstyle { color:Black; transition: transform .2s; text-align: center; margin-top: 80vh; } .Headerstyle:hover { transform: scale(1.5) ...

Is it possible to ensure that two form fields are identical using HTML?

Is it possible to enforce that the content in two form fields matches using HTML alone, or is JavaScript still necessary? For instance, if you have two password fields and desire to validate that a user has inputted identical data in both fields, are the ...

I am currently working on integrating a Netlify form into a contact form using React.js

I attempted various strategies but couldn't achieve any progress. I also consulted this post However, none of the suggestions seemed to work for me. Is there any other way to accomplish this? import React, { Component } from 'react'; impor ...

The function getComputedStyle('background-color') will return a transparent value that does not inherit from any ancestor element

When using getComputedStyle, it is expected to return the final computed CSS property value. However, for background-color, browsers tend to return "transparent" (or rgba(x,x,x,0)) instead of computing the inherited value from ancestors. The method only s ...

What is the reason behind IE7 and IE8 claiming to have 'hasLayout' when in reality it does not possess such a feature?

HTML: <div class="table" > <div class="row" > <span>Table with DIV</span> <span>column2</span> <span>column3</span> </div> <div class="row" > <span>col ...

Use the Arrow Keys to guide your way through the Page

I am looking to enhance user experience by allowing them to easily navigate through my webpage using the arrow keys on their keyboard. The goal is for users to be able to move from one section to the next in a seamless manner, unless they are focused on an ...

What is the integration of Google URL format with a PHP application?

When it comes to php websites, URLs are commonly written in the form of page.php?id=123 or rewrite moded page/Id/123 However, when looking at google I observed that URLs look more like google.com/search?q=Wordpress I attempted to structure website links ...

Suggestions for creating a simple implementation of a 3 x 3 cell layout with a large center using flexbox are

Creating a grid layout like this 3 x 3 cell with large center using CSS Grid is quite straightforward. .container { display: grid; grid-template-columns: 60px 1fr 60px; grid-template-rows: 60px 1fr 60px; } But what if we wanted to achieve the same ...