Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS equivalent to Adobe XD's "Background Blur" feature?

Developing a page based on an Adobe XD comp.

Since Adobe XD doesn't let you export CSS, I've been hand-coding each element's CSS attributes.

I'm trying to figure out what would be the CSS equivalents for the following screenshots.

Blurred rectangle with un-blurred text on top: Blurred rectangle with un-blurred text on top:

Blurred rectangle XD setings:

Blurred rectangle XD setings:

Based on the "Fill" and "81%", it's easy enough to grab the HEX value, convert it to RGB, then write background-color: rgba(54,93,62,0.81), but I have no idea what the equivalent CSS would be for the "Background Blur" settings.

like image 376
user3183717 Avatar asked Sep 21 '18 18:09

user3183717


People also ask

Can you blur background in CSS?

The backdrop-filter CSS property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything behind the element, to see the effect you must make the element or its background at least partially transparent.

How do I blur a background image in CSS?

Syntax. filter: blur(px); To apply a blur effect to the background image, with the blur function use the z-index property to set the stack order of the element, set the width and height 100% to have a full background image.

Which CSS property can be used with Blur 10px to blur an image?

The blur function applies a blur effect to a specified input image, which you can then use with the “filter” property to blur an image.

How does blur work in CSS?

The blur() function is an inbuilt function which is used to apply a blurred effect filter on the image. Parameters: This function accepts single parameter radius which holds the blur radius in form of length. This parameter defines the value of the standard deviation to the Gaussian function.


2 Answers

I had the same question and i would translate it like this:

XD:
Background color: RGB(54, 93, 62)
Blur: 16
Brightness: 15
Effect Opacity: 34%

CSS:

background-color: rgba(54, 93, 62, 0.34);
backdrop-filter: blur(16px) brightness(115%);

The blur stays in pixel.

The brightness in XD is -50 to +50. I would say it goes from -50% to -50% from 100% so its the same interval as 50% to 150%.

The effect opacity in XD is at 0% without color and with 100% full color. So its the same as setting the opacity of the background-color from 0 to 1.

like image 104
101 Coding und Design Avatar answered Sep 30 '22 11:09

101 Coding und Design


It is:

   -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.5); 

Demo: https://codepen.io/igcorreia/pen/YJeQgb

Make sure you check browser compatibility. As of early 2019 this is not supported in Chrome or Firefox - so for now you may need to export a flattened image with the blur built into it.

Update Sept. 2021

Check Browser Compatibility https://www.caniuse.com/?search=backdrop-filter

The simplest is:

backdrop-filter: blur(10px);
background-color: rgba(255, 255, 255, 0.5); 

Note, the background color must be 50%, 20% or 10% transparent in order for you to see the effect.

Firefox is still lacking behind on this effect.

like image 30
Ignacio Correia Avatar answered Sep 30 '22 11:09

Ignacio Correia