`blur()` CSS function
The blur() CSS function applies a Gaussian blur to the input image. It is used as a value for the filter and backdrop-filter properties.
The blur() CSS function applies a Gaussian blur to the input image. It is used as a value for the filter and backdrop-filter properties.
CSS Demo: blur()
```css interactive-example-choice filter: blur(0);
```css interactive-example-choice
filter: blur(4px);
```css interactive-example-choice filter: blur(1.5rem);
```html interactive-example
<section id="default-example">
<img
class="transition-all"
id="example-element"
src="/shared-assets/images/examples/firefox-logo.svg"
width="200" />
</section>
Syntax
/* No blur */
blur()
blur(0)
/* Blur with 8px radius */
blur(8px)
/* Blur with 1.17rem radius */
blur(1.17rem)
Parameters
- length
- : Specifies the radius of the blur. It defines the value of the standard deviation to the Gaussian function, that is, how many pixels on the screen blend into each other. Therefore, a larger value will create more blur. A value of
0leaves the input unchanged. The initial value for interpolation is0. Percentage values and negative values are invalid. The default value is0.
Return value
A filter-function value.
Formal syntax
Examples
Using the SVG filter
This example shows three images for comparison: an image with a blur() filter function applied, an image with the equivalent SVG filter applied, and the original image.
SVG
The SVG feGaussianBlur filter element can also be used to blur content. We set the stdDeviation to the blur radius, then we can reference the SVG effect by the ID of the filter:
```html live-sample___svg-filter
The following declarations produce the same effect:
```css
filter: blur(3.5px);
filter: url("#blur35"); /* with embedded SVG */
filter: url("fileName.svg#blur35"); /* external SVG */
CSS
We include CSS that will blur elements based on their css-filter or svg-filter class:
```css live-sample___svg-filter .css-filter { filter: blur(3.5px); }
.svg-filter { filter: url("#blur35"); }
```css hidden live-sample___svg-filter
th,
td {
padding: 5px;
}
```html hidden live-sample___svg-filter
blur() filter |
SVG filter equivalent | Original image |
|---|---|---|
|
|
|
```
100%
Specifications
Browser compatibility
See also
- CSS filter effects module
- The other filter-function functions available to be used in values of the filter and backdrop-filter properties include:
- brightness()
- contrast()
- drop-shadow()
- grayscale()
- hue-rotate()
- invert()
- opacity()
- saturate()
- sepia()