| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| "http://www.w3.org/TR/html4/loose.dtd"> |
| |
| <html lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <title>Position fixed</title> |
| <style type="text/css" media="screen"> |
| body { |
| height: 1000px; |
| width: 1000px; |
| } |
| #fixed { |
| position: fixed; |
| top: 0; |
| left: 0; |
| height: 100px; |
| width: 100px; |
| opacity: 0.8; /* makes this a compositing layer without assigning a transform */ |
| background-color: orange; |
| } |
| |
| .box { |
| height: 50px; |
| width: 50px; |
| background-color: green; |
| } |
| |
| .compositing { |
| -webkit-transform: translateZ(0); |
| } |
| |
| p { |
| position: absolute; |
| left: 50px; |
| top: 150px; |
| } |
| </style> |
| <script type="text/javascript" charset="utf-8"> |
| window.addEventListener('load', function() { |
| window.scrollBy(50, 50); |
| }, false); |
| </script> |
| </head> |
| <body> |
| |
| <p>You should see a green square in the top left corner of an orange box.</p> |
| <div id="fixed"> |
| <div class="compositing box"> |
| </div> |
| </div> |
| |
| </body> |
| </html> |