Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using a div to blur an image behind it? [duplicate]

Tags:

Is it possible to code a div to enable it to blur whatever image is under it?

something like this:

enter image description here

Could this be done somehow with -webkit maybe?

like image 552
Dr Robotnik Avatar asked Oct 30 '13 15:10

Dr Robotnik


People also ask

How do I make a div background blurry?

The trick is to use background-position:fixed; on html / body and the element to blur on top of it, so , both background-image lays on the same area of the window. The duplicate uses an extra element, this can be a pseudo element if you do not wish to modify HTML structure. Flex can also be used to center body.

How do you blur content behind an element?

backdrop-filter: blur(10px); It will blur area behind the element.

How do I blur part of an image in CSS?

You choose a suitable background-position for the outer div. Make inner div position:absolute . This is where the blur appears. Apply blur to the :before selector.

Can you blur a div?

Blurring the background elements of a div can be achieved using backdrop-filter . All the elements placed under the div are going be blurred by using this.


2 Answers

Not with CSS on its own, but you can pull a similar effect off with Canvas and the StackBlurforCanvas library. See this

UPDATE: Looks like backdrop-filter was recently introduced to Webkit nightly, so eventually we'll be able to do this with CSS only. Yay!

like image 75
Dre Avatar answered Oct 14 '22 06:10

Dre


Unfortunately this can't be done purely using CSS. Although webkit-filter supports blur, it doesn't support blurring anything other than the element that it applies to.

There is a more hacky way to do this, described here - http://css-tricks.com/blurry-background-effect/

like image 20
Tim Ebenezer Avatar answered Oct 14 '22 07:10

Tim Ebenezer