Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <!-- Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | - http://creativecommons.org/publicdomain/zero/1.0/ --> |
michael@0 | 4 | <html> |
michael@0 | 5 | <head> |
michael@0 | 6 | <title>CSS Test: Sticky Positioning - stacking context</title> |
michael@0 | 7 | <link rel="author" title="Corey Ford" href="mailto:cford@mozilla.com"> |
michael@0 | 8 | <link rel="match" href="stacking-context-1-ref.html"> |
michael@0 | 9 | <meta name="assert" content="Sticky positioning should establish a stacking context"> |
michael@0 | 10 | <style> |
michael@0 | 11 | body { |
michael@0 | 12 | margin: 0; |
michael@0 | 13 | } |
michael@0 | 14 | div { |
michael@0 | 15 | width: 100px; |
michael@0 | 16 | height: 100px; |
michael@0 | 17 | } |
michael@0 | 18 | #static { |
michael@0 | 19 | position: absolute; |
michael@0 | 20 | top: 20px; |
michael@0 | 21 | left: 20px; |
michael@0 | 22 | background-color: blue; |
michael@0 | 23 | z-index: 1; |
michael@0 | 24 | } |
michael@0 | 25 | #sticky { |
michael@0 | 26 | position: sticky; |
michael@0 | 27 | top: 0; |
michael@0 | 28 | left: 0; |
michael@0 | 29 | background-color: black; |
michael@0 | 30 | } |
michael@0 | 31 | #inner { |
michael@0 | 32 | position: relative; |
michael@0 | 33 | top: 40px; |
michael@0 | 34 | left: 40px; |
michael@0 | 35 | background-color: gray; |
michael@0 | 36 | z-index: 2; |
michael@0 | 37 | } |
michael@0 | 38 | </style> |
michael@0 | 39 | <body> |
michael@0 | 40 | <div id="static"></div> |
michael@0 | 41 | <div id="sticky"> |
michael@0 | 42 | <div id="inner"></div> |
michael@0 | 43 | </div> |
michael@0 | 44 | </body> |
michael@0 | 45 | </html> |