Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

blur() CSS Function

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The blur() CSS function is part of the filter property and is used to apply a Gaussian blur to an element, effectively softening its edges and reducing detail. This creates a visually “out-of-focus” effect, similar to what you would see in photography when a lens is not focused on a subject. The intensity of the blur is controlled by a length value, typically in pixels, with larger values producing a stronger blur.

When blur() is applied, it affects the rendered content of an element, including images, text, and backgrounds. However, it does not alter the element’s layout or underlying HTML structure, so it can be safely used for decorative effects without impacting the flow of content. You can combine blur() with other filter functions such as brightness() or contrast() to achieve more complex visual effects.

For example, applying a subtle blur to a img element can create a soft background effect:

img.background {
  filter: blur(5px);
}

Additionally, blur() can be animated using transition to create smooth focus or hover effects. For instance, you could blur an image when hovering over a container to draw attention to overlay text:

.container img {
  transition: filter 0.3s ease;
}

.container:hover img {
  filter: blur(8px);
}

The blur() function is widely supported across modern browsers and is particularly useful for background effects, image overlays, and enhancing focus on specific page elements without needing additional image editing.

Syntax

blur() = blur( <length>? )

Values

  • lengthIt defines the value of the standard deviation to the Gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. A value of 0 leaves the image unchanged.

Example

<body>

<div class="background-container">
<img src="https://picsum.photos/800/600" alt="Sample Image" class="blur-me">

<div class="content-overlay">
<h1>CSS Filter: Blur()</h1>
<p>The image behind this text is being modified by CSS.</p>
</div>
</div>

</body>
/* Basic reset */
body {
margin: 0;
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #1a1a1a;
color: white;
}

.background-container {
position: relative;
width: 500px;
height: 300px;
overflow: hidden;
border-radius: 15px;
}

.blur-me {
width: 100%;
height: 100%;
object-fit: cover;

/* THE BLUR EFFECT */
/* 0px is no blur; higher px = more blur */
filter: blur(8px);
}

.content-overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
width: 80%;
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

Browser Support

The following information will show you the current browser support for the CSS blur() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!