Blur effects in CSS allow elements to seamlessly blend with their backgrounds, creating

Whenever I apply a CSS blur effect to my image and place it inside a div to maintain straight borders, the image ends up blending with the other elements:

Here is my code: https://drive.google.com/file/d/0B2t-Ql_mj7hRU0NHZkpDbHZPWWM/edit?usp=sharing

Is there a way to achieve straight borders without blending issues?
This problem seems to occur only in Google Chrome.

Answer №1

If you are talking about making it blend in with the background color, then you will need to assign a background-color to it. However, if you simply want it to appear as a square shape, you can try modifying your original code like this: http://jsfiddle.net/Incredulous/6V9ua/

I have removed the duplicate CSS for the img selector and added px at the end of -20. Your updated CSS should now look like this:

body{
    background:red;
    text-align:center;
    }
img{
    -webkit-filter: blur(20px); 
    -moz-filter: blur(20px); 
    filter: blur(20px);
    margin:-20px;
    }
div{
    overflow:hidden;
    display:table;
    background-color:white;
    }

The addition of display:table; ensures that your div container fits the content within, while background-color:white; prevents any red from bleeding onto the edges.

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

"Error" - The web service call cannot be processed as the parameter value for 'name' is missing

When using Ajax to call a server-side method, I encountered an error message: {"Message":"Invalid web service call, missing value for parameter: \u0027name\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(O ...

The origin of the image is specified within the HTML document

I recently encountered an issue while trying to include images in my HTML file. When I used a local file path like background-image: url('file:///C:/Users/faycel/Desktop/site%20guide/paris.jpg'), the image displayed correctly. However, when I tri ...

inject the HTML content into the <div> container

Snippet: https://jsfiddle.net/x9ghz1ko/ (Includes notes.) In my HTML file, there are two distinct sections: <section class="desktop_only"> and <section class="mobile_only">. The challenge lies in positioning a JavaScript sc ...

The Markup() function in Flask is used to generate markup content that is not enclosed within

Before I explain my issue, let me go ahead and share the code with you. Using Jinja in HTML <p>{{ item }}</p> 'Flask' item = Markup('<ul><li>list item 1</li><li>list item 2</li></ul>') ...

Is there a way to automate the clicking of a button on this webpage if using .click() is not effective?

Currently, I am developing an extension that facilitates purchasing products from Flipkart during flash sales. However, on the product page, I am unable to click the "Buy Now" button using JavaScript as it returns undefined. Here is the code for the Buy No ...

Is it possible in CSS to ensure consistent width across various platforms and devices, regardless of their physical dimensions?

When it comes to altering the width (or any other properties) of an element using @media queries, there are multiple approaches available. One option is to utilize aspect pixel ratio, device width, and height. Find out more at https://developer.mozilla.or ...

identifying unused class names within an HTML codebase

Is there a way or tool available for detecting unused class names in HTML code? I have some HTML code with old Bootstrap, jQuery, and personalized CSS styles like below: <div class="clear fot-her likes tab-sub">content</div> But I n ...

Toggle two elements simultaneously by clicking on one of them - displaying one element while hiding the other

I am facing an issue with toggling the visibility of two divs using a button click event. One div is initially hidden with a display property set to none, while the other div is visible. My goal is to have this behavior toggle on each click event - the fi ...

Is it possible to personalize the browser icon during a Selenium session?

When running Selenium sessions, I occasionally need to spawn a new browser while leaving the old one active for manual intervention later on. However, it can be challenging to differentiate between the abandoned session and the current one. What I would l ...

Is it possible to integrate a MySQL database with an HTML form?

My goal is to allow users to input a name that exists in the database. Upon selecting "Go", I want to display all results from the contact table that match the user's input. However, when I run the HTML code, the PHP script executes but returns "0 res ...

What is the best way to add an array object's property value to HTML?

I am attempting to build a basic carousel using DOM manipulation. I am not sure if it can be done in Angular, but my idea involves creating an array of objects with specific properties that I want to pass to the HTML through interpolation. However, I am ...

Bring JavaScript Function into Vue's index.html File

Recently in my code files, I noticed the following: function example() { console.log("testing"); } In another file, I have something like this: <head> <script src="../src/example.js" type="text/babel"></sc ...

Maintaining the active style of Asp.NET 4.0 Menu control even after the mouse is released

Utilizing a standard asp.net menu in an asp.net 4.0 web application, this setup is for a standard web application and not any version of MVC applications currently available. The issue at hand is relatively straightforward. CSS styles are applied to the d ...

Enhance your website's user experience by implementing Bootstrap breadcrumb styling integrated

I am a beginner with bootstrap and currently trying to customize the breadcrumb styling. I attempted the following code which resulted in the desired inline layout. <div class="BreadCrumbs"> <a href="www.yahoo.com" >Yahoo</a&g ...

Enhancing the appearance of the MUI DatePicker

I'm currently using a DatePicker component from Mui Lab and I'm attempting to customize the appearance of the Calendar component by incorporating some border or background color. Although I've tried utilizing the PaperProps prop for DatePick ...

Issue arising from the rendering of items in a Navigation Bar

I'm encountering an issue where only the last item of the navbar is being rendered even though the data appears to be correct. I've tried hard coding the data into the components but the same error persists.https://i.sstatic.net/ccEuB.png , https ...

What could be the reason behind Lottie rendering an SVG element outside of its parent div?

After struggling with this issue for an entire day, I'm seeking help to implement an animation using Lottie on my website. The animation format is 1080*1920, but the problem arises when trying to fit it within a div. The dimensions of the div are set ...

Is the initial carousel element failing to set height to 100% upon loading?

If you take a look here, upon loading the page you will notice a DIV at the top. It is labeled "content" with "content_container" wrapped around it and finally, "page" around that. Clicking the bottom left or right arrows reveals other DIVs with similar ta ...

Automatically Access a JS/CSS File in the Developer Tools 'Sources' Section

I am aware that I can customize my own Panel in the Chrome Developer Tools, but I am curious if there is a way to click a button within my panel and have the Developer Tools open a particular script or stylesheet in the 'Sources' panel related to ...

Create a stunning design with Bootstrap 4 by incorporating a full-width background for both the table header and rows,

Bootstrap 4 offers a convenient table feature, but I'm having trouble aligning it with the design provided to me. The design requires full-width background colors for both the dark header (thead) and the light body (tbody), all while keeping the eleme ...