Blur effect on backdrop-filter causing shadowy inset borders (specific to Chrome and Windows)

Note: The issue mentioned below has been resolved in the latest version of Chrome (119.0.6045.200).

While transitioning on backdrop-filter, I have observed a dark inset shadow that is only visible during the transition.

This behavior seems to occur only in chrome/webkit based browsers on Windows (10 & 11). My current Chrome version is 'Version 116.0.5845.190 (Official Build) (64-bit)'

Interestingly, this issue occurs in Stack Overflow's inline 'run code snippet' but not in the code snippet editor. The same inset borders are also visible in my actual project.

I am looking for a solution to remove these inset borders. Is this a coding issue or unintended behavior by the browser?

Examples

Chrome displaying the issue:
https://i.stack.imgur.com/Yy536.gif
Meanwhile, Firefox appears unaffected:
https://i.stack.imgur.com/rDsar.gif

Example code:

In Chrome, clicking this button reveals black inset borders, although they are not visible within the Stack Overflow snippet editor. You can also observe this behavior in this JSFiddle.

function toggle() {
  document.getElementsByClassName("inner")[0].classList.toggle('blurred')
}
.inner {
  margin: 20px;
  padding: 10px;
  width: 100%;
  height: 200px;
  display: inline-block;
  border: 2px solid white;
  border-bottom: 2px solid rgba(0, 0, 0, .1);
  box-sizing: border-box;
  transition: backdrop-filter 500ms;
}

.blurred {
  backdrop-filter: blur(5px);
}

.text {
  position: absolute;
  left: 20%;
  top: 20%;
  font-size: 40px;
  color: white;
  font-family: sans-serif;
  margin: 20px;
  padding: 10px;
  width: 100%;
  height: 200px;
  display: inline-block;
  box-sizing: border-box;
}

.container {
  margin: 10px;
  display: flex;
  position: relative;
  background: linear-gradient(135deg, #57cdff, #05a915);
}
<button onclick="toggle()">toggle backdrop-filter: blur(5px)</button>
<div class="container">
  <div class="text">
    Hello!
  </div>
  <div class="inner">
  </div>
</div>

Answer №1

You have the ability to adjust the opacity of an element that is already equipped with a backdrop-filter.
I made some modifications to your code in this example:

button.onclick = () =>  document.querySelector('.text').classList.toggle('blurred');
.container {
  background: linear-gradient(135deg, #57cdff, #05a915);
  padding: 20px;
}

.text {
  font-family: sans-serif;
  font-size: 40px;
  color: white;
  border: 2px solid white;
  border-bottom-color: rgba(0, 0, 0, .1);
  min-height: 200px;
  display: grid;
  place-items: center;
  position: relative;
}

.text:after{
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(5px);
  transition: opacity .5s;
  opacity: 0;
  pointer-events: none;
}

.text.blurred:after {
  opacity: 1;
  pointer-events: auto;
}
<button id="button">toggle backdrop-filter: blur(5px)</button>
<div class="container">
  <div class="text">Hello!</div>
</div>

Answer №2

After encountering the same problem myself, I have made some discoveries:

  • The issue does not depend on whether you are using Windows 10 or Windows 11, but rather on Chrome's settings regarding "Use hardware acceleration when available."
  • You can adjust this setting by visiting chrome://settings/system
  • With hardware acceleration enabled, there is a shadow inset bug during transitions that disappears once the transition is finished.
  • With hardware acceleration disabled, the image does not become blurred at the edges.
  • Firefox does not experience this issue.

I am not sure if Chrome 91 resolved this problem two years ago only for it to return now. Currently, my workaround is similar to what imhvost recommended: applying the backdrop-filter blur effect to a separate div and transitioning its opacity from 0 to 1. Though not perfect, this solution suffices for now as I wait for a more permanent fix.

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

Arranging SVG icons in a row within the navigation bar

Having trouble aligning the icons side by side? Even with margin and padding adjustments, I couldn't get it right. I've scoured multiple sites for a solution but couldn't find one. As an attempt to fix this, I created a bar with aligned butt ...

Using React Native's stylesheet to apply multiple values in a CSS statement

Here's a scenario to help clarify my question: Imagine I want to add margin to an element in the following way: const myView = () => <View style={styles.viewStyle}></View> const styles = StyleSheet.create({ viewStyle: { margin: ...

What is the best way to trigger a new css animation on an element that is already in the midst of

Let's talk about an element that already has an animation set to trigger at a specific time: .element { width: 100%; height: 87.5%; background: #DDD; position: absolute; top: 12.5%; left: 0%; -webkit-animation: load 0.5s ease-out 5s bac ...

Ensuring the bootstrap footer remains anchored at the bottom of the page content

I've been struggling for 3 days to get the footer to stay at the bottom of my webpage content. I've searched through many similar questions, but still can't find a solution. Here is my code: .container{position:relative;} footer{position: ...

Styling Lists: How to Create a Second Line Indent with Counters

There seems to be an issue with the second line indent when using a custom counter. When attempting to use 'list-style-type: decimal', the numbering does not display as desired, for example: ol { counter-reset: ci-counter; list-style- ...

Images in Chrome are shivering when animated at unconventional positions

I am attempting to create a masking animation that reveals an image from its center. The animation is working well, but I have encountered a problem in Chrome where the revealed content shakes. Here is an example on jsfiddle: http://jsfiddle.net/BaKTN/ I ...

Issues with the Content Editable Functionality

While working on my website, I encountered a strange issue. For some reason, I can't seem to get the contenteditable="true" attribute to work on the heading with the ID "hl". It would be awesome if someone could help me figure out how to mak ...

Modifying the appearance of select components in React MUI using CSS

Can someone help me modify the appearance of the react material UI select component to match this design: I have already applied the following CSS styling: const styles = { width:'250px', border:'1px solid gray', borderBot ...

Do not incorporate a div in the overlay

I have an image inside a container. When hovering over the image/container, overlay information is displayed (which is currently working correctly). The overlay should cover the entire container (the grey part) where the image is located. The product-tit ...

Certain CSS styles for components are missing from the current build

After building my Vue/Nuxt app, I noticed that certain component styles are not being applied. In the DEVELOPMENT environment, the styles appear as expected. However, once deployed, they seem to disappear. All other component styles render properly. Dev ...

Display or conceal a field based on the content of another field using jQuery

Is there a way to hide or show a field on my website based on the value in the shopping cart? I've created a function for this, but I'm struggling with the condition. Can you help me figure out how to write it correctly? <script> $(docume ...

Creating a flexible grid layout in CSS without relying on any pre-made frameworks

Suppose I am working with the following HTML structure <div class="option"> <input type="checkbox" /> <label>Checkbox</label> </div> <div class="option"> <input type="checkbox" /> <label>Chec ...

Explicitly employ undefined constants deliberately

So I am working on a project called WingStyle: https://github.com/IngwiePhoenix/WingStyle. It is still in the development phase, and I'm looking for ways to improve its functionality. One thing I want to address is the use of quotes. For example, whe ...

The li elements in a horizontal menu all have equal spacing between them, filling the width of the ul

I designed a horizontal menu navigation system using HTML elements ul for the main menu container and li for menu list items. The layout is structured with display table for ul and table-cell for li. However, I encountered an issue where there are inconsis ...

Do flexible layouts require more effort and time to create and upkeep compared to fixed width layouts?

Are flexible layouts more challenging to create and maintain than fixed width layouts, and do they take longer to design? Does a flexible layout only involve setting the width, height, and font size in em or %? What are the main advantages of using a fle ...

How to center align an input vertically with Bootstrap 3

I am having trouble vertically aligning an input in my project. Interestingly, my code works for a span but not for the input! I'm puzzled - what could be the reason behind this? JSFiddle Here is the CSS code snippet: .float { display: table-cel ...

Display sub navigation when clicked in WordPress

I currently have the default wordpress menu setup to display sub navigation links on hover, but I am interested in changing it so that the sub navigation only appears when the user clicks on the parent link. You can view my menu here https://jsfiddle.net/f ...

Using JavaScript to generate a <style> element and accessing the cssRules

After spending countless hours trying to solve this problem, I'm hoping that my question isn't too foolish. This is a continuation of a previous question about creating a style tag with JavaScript on Stack Overflow. The solutions provided by Tom ...

Display the initial three image components on the HTML webpage, then simply click on the "load more" button to reveal the subsequent two elements

I've created a div with the id #myList, which contains 8 sub-divs each with an image. My goal is to initially load the first 3 images and then have the ability to load more when clicking on load more. I attempted to follow this jsfiddle example Bel ...

Typewriter Effect: The caret is advancing too quickly

I am trying to achieve a typewriter effect on my text, but the blinking cursor is extending further than the actual text. See Image for Problem Here is the code I am using: HTML: <div class="title"> <h1>Hi, I'm ConnerDE< ...