summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/filter-effects/backdrop-filters-opacity.html
blob: b3703c30673a79973cad601ebab9f296bf86f5d1 (plain)
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
<!DOCTYPE html>
<title>CSS Backdrop Filters Animation: Opacity</title>
<link rel="author" href="mailto:masonf@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/filter-effects-2/#BackdropFilterProperty">
<link rel="match" href="backdrop-filters-opacity-ref.html">
<style>
    /* Note that per the spec, the backdrop image is read back, filters
       are applied, any additional content is drawn, and then the resulting
       image is composited back into the parent (over the top of the
       existing backdrop image) using source-over compositing. In this case,
       the only backdrop filter is opacity, so the backdrop image will be
       filtered by opacity 50%, the green box (100% opacity) is drawn over
       that at 100% opacity, and then the entire thing is composited into
       the backdrop, which already contains the 100% opacity blue square.
       So the blue square stays 100% blue. */
    .square {
        position: absolute;
        width: 100px;
        height: 100px;
        top: 100px;
        left: 100px;
        background: blue;
    }
    .filt {
        backdrop-filter: opacity(50%);
        position: absolute;
        width: 200px;
        height: 200px;
        top: 50px;
        left: 50px;
    }
    .greenbox {
        position: absolute;
        width: 50px;
        height: 50px;
        top: 75px;
        left: 75px;
        background: green;
    }
</style>
<p>You should see a blue square with a green box inside.</p>
<div class="square"></div>
<div class="filt">
    <div class="greenbox"></div>
</div>