Apply a blurred effect to the entire website except for one specific element

Recently, I implemented the .blur class on the body element to create a blurred effect for the entire website.

CSS

.blur {
    filter: blur(1px);
    filter: url("blur.svg#gaussian_blur");
    -webkit-filter: blur(1px);
    -o-filter: blur(2px);
}

HTML

<body class="blur">
...
<div class="mustBeClear"></div> <!-- located somewhere in the page-->
...
</body>

The question arises on how to maintain the clarity of elements with the .mustBeClear class while applying the overall blur effect.

I attempted the following:

.mustBeClear{
    filter: none; 
    -webkit-filter: none;
    -o-filter: none;
}

Unfortunately, this solution did not yield the desired outcome!

Answer №1

It is impossible to selectively undo an SVG filter for a single child element because filters are applied to the entire parent element.

A better approach would be to only blur the specific element that needs to be blurred and then use absolute positioning on another element without the blur effect.

Here is a practical example to demonstrate this concept:

.container {
    position: relative;
    top: 50px;
    left: 50px;
}

.blur {
    filter: blur(5px);
    -webkit-filter: blur(5px);
    -o-filter: blur(5px);
}

#text {
    position: absolute;
    left: 50px;
    top: 50px;
}
<div id="container">
    <div class="blur">
<img src="http://i.imgur.com/5LGqY2p.jpg?1" />
    </div>
    <div id="text">Not Blurred Text</div>
</div>

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

Is there a way to embed a span within a word without causing it to break during wrapping?

As I create a lyrics sheet with chords, I'm facing an issue. Placing the chord (as a span) inside a word for precise positioning causes the word to split in half when the line wraps. How can I prevent this from happening? https://i.sstatic.net/GlNYb. ...

send a variable across multiple web pages at the same time

Currently, I have a variable that needs to be passed through multiple PHP pages. The code below effectively sends the variable to one page (index.php). echo "<a href='index.php?PHOTO=".$i."'>select</a>"; However, I am wondering how ...

HTML experiences confusion as JSON tosses undefined data

Can someone assist me with API integration? I am new to this and trying to display the Poster, Title, and Year from an API URL. Here is the code I have been working on. When I log in, it shows JSON in an array but throws "undefined" in front-end. Your help ...

Load the div first before delaying the load of the next element using jQuery

Hey there! I'm currently working on a gallery with left-floated divs, where each picture serves as the background for the div. What I'd like to achieve is having each picture load with a slight delay; meaning the first picture loads, then waits f ...

Create HTML content from a file retrieved from the server

I have been working on a dynamic website project, diving into web development from scratch despite having coding experience in general. As I navigate Angular CLI and Bootstrap, I've come across a fundamental question: Do modern websites house all thei ...

Save a FlexTable as an HTML file using R script

Is there a way to export a FlexTable created using the ReporteRs package as an .html file in RStudio without losing the formatting? Currently, I can manually save the table as a webpage by clicking on 'Export' and choosing 'Save as webpage& ...

Just sent out an email including an attachment with HTML content or a webpage link to access on Google

My email recipients primarily use Gmail as their email service provider. To address this, I saved the contents of this page as an HTML file named index.html and stored it on my drive for easy sending. However, the issue lies in the fact that the page does ...

SQL post commenting management system: aggregating all comments to a single post

What I'm Looking for: I am looking to display all comments related to a specific post directly under that post. This can be achieved by using a loop to showcase all the CommentTexts in a list. For instance, if there are 3 comments with PostNr = ...

In JavaScript, you can update the class named "active" to become the active attribute for a link

My current menu uses superfish, but it lacks an active class to highlight the current page tab. To rectify this, I implemented the following JavaScript code. <script type="text/javascript"> var path = window.location.pathname.split('/'); p ...

Show me how to customize the default confirmation box using just CSS!

Is it possible to style the standard window.confirm using only CSS without any additional JavaScript code? If so, how can this be achieved? ...

The HTML file that was downloaded appears to contain jumbled and nonsensical text

I recently downloaded some HTML files from an Android application. They display perfectly when opened within the app, but appear jumbled on my computer. There is also a CSS file included. If necessary, I can provide the CSS file for reference. While I am n ...

Unnecessary spacing found within the side navigation menu

Recently, I decided to practice my web development skills by creating a basic webpage using flexbox for the topnav and CSS Grid 12 column layout for the main content. Everything was going smoothly until I encountered some extra whitespace in the sidenav se ...

What is the best way to iteratively fade in data from a MySQL database one by one?

How can I load data from a MySQL database and display it one by one with a fade-in effect? Let's say I have a total of 40 images stored in the database. First, I want to display each image like this: <li class="img" style=" list-style: none; flo ...

What is the best way to incorporate a custom HTML tag into this PHP array?

Is there a way to integrate my own HTML tag into a section of PHP code? Specifically, I'm referring to the portion "This part needs an HTML tag". <div id="downbarek2"> <?php $vid = 59; function termSort($a, $b) {return st ...

Elements of <nav> within a <footer> section

I've recently started using HTML5 display elements like header, footer, and nav. While reading about the nav element in particular, I found this interesting information in the HTML5 spec: The nav element is primarily intended for major navigation b ...

The table's width exceeds the appropriate size

Take a look at the code snippet below <%-- Document : index Created on : Feb 7, 2014, 1:03:15 PM --%> <%@page import="java.util.Map"%> <%@page import="java.util.Iterator"%> <%@page import="analyzer.DataHolder"%> <%@p ...

How to dynamically adjust font size using Javascript

Is there a way to adjust the font size of the left-column using JavaScript? <div id="left-column"> <a href="">1</a><br> <a href="">2</a><br> <a href="">3</a><br> <a href=""> ...

I am not encountering any error messages, but when I attempt to click on the form, the mouse cursor does not change to the expected form type

While there are no errors showing up in the Chrome Developers Error code, I am facing an issue with my form where the text fields are not visible. It should be a simple task, but it has turned into a headache for me. I would greatly appreciate any help i ...

What steps should I take to make my include function operational?

As I develop a website for our entertainment company, I encounter language translation issues. Due to our diverse clientele, I implemented a multilingual feature on the site. However, during testing, all the text appeared blank. I suspect that the root of ...

The reliability of jQuery posting varies

My current setup involves using jQuery to send data to an external source with the code snippet provided below. As part of the process, I'm also ensuring that all input fields are filled out correctly. However, there has been a strange issue where the ...