transform-abspos-002.html (1321B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Test (Transforms): Containing Block for Fixed Positioning (left/top offsets)</title> 5 <link rel="author" title="Keith Schwarz" href="mailto:keith@keithschwarz.com"> 6 <link rel="author" title="Aryeh Gregor" href="mailto:ayg@aryeh.name"> 7 <link rel="help" href="http://www.w3.org/TR/css-transforms-1/#transform-rendering"> 8 <meta name="assert" content='"In the HTML namespace, any value other than 9 'none' for the transform results in the creation of . . . a 10 containing block. The object acts as a containing block for fixed 11 positioned descendants." This means fixed-position elements need to be 12 rooted at a transformed ancestor, rather than the viewport.'> 13 <link rel="match" href="transform-abspos-ref.html"> 14 <style> 15 body > div { 16 width: 100px; 17 height: 200px; 18 transform: translate(50px, 50px); 19 background: gold; 20 } 21 body > div > div { 22 width: 200px; 23 height: 100px; 24 position: fixed; 25 left: 50px; 26 top: 100px; 27 background: navy; 28 color: gold; 29 } 30 </style> 31 </head> 32 <body> 33 <div> 34 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 35 <div> 36 0 1 2 3 4 5 6 7 8 9 37 </div> 38 </div> 39 </body> 40 </html>