As an illustration, consider taking a look at this specific page. How could one go about blurring all elements on the page except for a selected element while keeping that element in focus?
If the entire content area is blurred, the focused element will also be affected by the blur (as you can't unblur a child of a blurred parent). It's not practical to individually determine which elements should be blurred and which shouldn't. Additionally, the element should remain within the content area without any HTML transformations.
The desired outcome would transform from this: https://i.sstatic.net/fbTHD.png
To this using only CSS: https://i.sstatic.net/QDtnq.png
While it may seem simple to just overlay with a dark layer using absolute positioning and give the focused element a relative
position with a higher z-index
, unfortunately, blurring that dark overlay does not affect the content behind it:
https://i.sstatic.net/Gh7a3.png