Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /css/css-contain/contain-paint-stacking-context-001b.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE HTML>
<title>'will-change: contain' establishes stacking context.</title>
<link rel="author" title="Psychpsyo" href="mailto:psychpsyo@gmail.com">
<link rel="match" href="contain-paint-stacking-context-001-ref.html">
<style>
  div {
    width: 100px;
    height: 100px;
  }
  #front {
    background-color: green;
    /* makes a stacking context and puts this on top */
    position: absolute;
    z-index: 10;
  }
  #back {
    will-change: contain;
  }
  #notOnTop {
    background-color: red;
    /* z-index is higher than on #front, but this should still be covered up because it is inside #back, which has 'will-change: contain' */
    position: absolute;
    z-index: 1000;
  }
</style>
<div id="front"></div>
<div id="back">
  <div id="notOnTop"></div>
</div>
Test succeeds if there is no red.