Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 <!DOCTYPE html>
2 <!-- Any copyright is dedicated to the Public Domain.
3 - http://creativecommons.org/publicdomain/zero/1.0/ -->
4 <html>
5 <head>
6 <title>CSS Test: Sticky Positioning - left+right, at middle</title>
7 <link rel="author" title="Corey Ford" href="mailto:cford@mozilla.com">
8 <link rel="match" href="left-right-2-ref.html">
9 <meta name="flags" content="dom">
10 <meta name="assert" content="Left+right sticky, scrolled to the middle: should stay in its normal position">
11 <style>
12 #scroll {
13 width: 100px;
14 height: 100px;
15 overflow: hidden;
16 border: 1px solid black;
17 white-space: nowrap;
18 }
19 #scroll div {
20 display: inline-block;
21 }
22 .fill {
23 width: 100px;
24 height: 1px;
25 }
26 #contain {
27 width: 200px;
28 height: 10px;
29 background-color: gray;
30 }
31 #sticky {
32 position: sticky;
33 left: 10px;
34 right: 10px;
35 width: 10px;
36 height: 10px;
37 background-color: black;
38 }
39 </style>
40 <body>
41 <div id="scroll">
42 <div class="fill"></div
43 ><div id="sticky"></div
44 ><div class="fill"></div>
45 </div>
46 <script type="text/javascript">
47 document.getElementById("scroll").scrollLeft = 50;
48 </script>
49 </body>
50 </html>