-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
129 lines (98 loc) · 3.17 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
title: backdrop-filter
slug: Web/CSS/backdrop-filter
page-type: css-property
browser-compat: css.properties.backdrop-filter
---
{{CSSRef}}
The **`backdrop-filter`** [CSS](/en-US/docs/Web/CSS) property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything _behind_ the element, to see the effect the element or its background needs to be transparent or partially transparent.
{{EmbedInteractiveExample("pages/css/backdrop-filter.html")}}
## Syntax
```css
/* Keyword value */
backdrop-filter: none;
/* URL to SVG filter */
backdrop-filter: url(commonfilters.svg#filter);
/* <filter-function> values */
backdrop-filter: blur(2px);
backdrop-filter: brightness(60%);
backdrop-filter: contrast(40%);
backdrop-filter: drop-shadow(4px 4px 10px blue);
backdrop-filter: grayscale(30%);
backdrop-filter: hue-rotate(120deg);
backdrop-filter: invert(70%);
backdrop-filter: opacity(20%);
backdrop-filter: sepia(90%);
backdrop-filter: saturate(80%);
/* Multiple filters */
backdrop-filter: url(filters.svg#filter) blur(4px) saturate(150%);
/* Global values */
backdrop-filter: inherit;
backdrop-filter: initial;
backdrop-filter: revert;
backdrop-filter: revert-layer;
backdrop-filter: unset;
```
### Values
- `none`
- : No filter is applied to the backdrop.
- `<filter-function-list>`
- : A space-separated list of {{cssxref("<filter-function>")}}s or an [SVG filter](/en-US/docs/Web/SVG/Element/filter) that will be applied to the backdrop. CSS `<filter-function>`s include {{CSSxRef("filter-function/blur", "blur()")}}, {{CSSxRef("filter-function/brightness", "brightness()")}}, {{CSSxRef("filter-function/contrast", "contrast()")}}, {{CSSxRef("filter-function/drop-shadow", "drop-shadow()")}}, {{CSSxRef("filter-function/grayscale", "grayscale()")}}, {{CSSxRef("filter-function/hue-rotate", "hue-rotate()")}}, {{CSSxRef("filter-function/invert", "invert()")}}, {{CSSxRef("filter-function/opacity", "opacity()")}}, {{CSSxRef("filter-function/saturate", "saturate()")}}, and {{CSSxRef("filter-function/sepia", "sepia()")}}.
## Formal definition
{{cssinfo}}
## Formal syntax
{{csssyntax}}
## Examples
### CSS
```css
.box {
background-color: rgb(255 255 255 / 30%);
backdrop-filter: blur(10px);
}
body {
background-image: url("anemones.jpg");
}
```
```css hidden
html,
body {
height: 100%;
width: 100%;
}
.container {
background-size: cover;
align-items: center;
display: flex;
justify-content: center;
height: 100%;
width: 100%;
}
.box {
border-radius: 5px;
font-family: sans-serif;
text-align: center;
max-width: 50%;
max-height: 50%;
padding: 20px 40px;
}
```
### HTML
```html
<div class="container">
<div class="box">
<p>backdrop-filter: blur(10px)</p>
</div>
</div>
```
### Result
{{EmbedLiveSample("Examples", 600, 400)}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{cssxref("filter")}}
- {{cssxref("<filter-function>")}}
- {{cssxref("background-blend-mode")}}, {{cssxref("mix-blend-mode")}}
- [CSS filter effects](/en-US/docs/Web/CSS/CSS_filter_effects)
- [CSS compositing and blending](/en-US/docs/Web/CSS/CSS_compositing_and_blending)