position_absolute_transform.rml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <rml>
  2. <head>
  3. <title>Absolutely positioned box with transformed parent</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://www.w3.org/TR/css-transforms-1/#containing-block-for-all-descendants" />
  6. <meta name="Description" content="Elements with a local transform or perspective should act as the containing block for absolutely positioned children. "/>
  7. <meta name="Assert" content="The child boxes should fit nicely at the bottom right corner of their parent elements."/>
  8. <meta name="Assert" content="The child boxes should clip correctly to their containers, when they are scrolled down."/>
  9. <style>
  10. .container {
  11. margin: 15dp 0;
  12. height: 250dp;
  13. background-color: #ddd;
  14. border: 3px #888;
  15. overflow: auto;
  16. transform: translateY(50%);
  17. }
  18. .tall { height: 1000px; }
  19. .transform {
  20. width: 150dp;
  21. height: 120dp;
  22. padding: 10dp;
  23. margin: auto;
  24. background-color: #f0f8ff;
  25. border: 5px #4682b4;
  26. font-size: 1.2em;
  27. transform: translate(15dp,5dp) rotate3d(0.8, 0, 1, 30deg);
  28. }
  29. .transform:hover { background-color: #fcffff; }
  30. .absolute {
  31. position: absolute;
  32. width: 50%;
  33. height: 50%;
  34. background-color: #e0cef7;
  35. border: 5px #663399;
  36. right: 0;
  37. bottom: 0;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div class="container">
  43. <div class="transform">
  44. Transformed element
  45. <div class="tall"></div>
  46. <div class="absolute">Absolute child</div>
  47. </div>
  48. <div class="tall"></div>
  49. </div>
  50. <div class="container">
  51. <div class="transform">
  52. Transformed element
  53. <div class="tall"></div>
  54. <div class="absolute" style="position: fixed">Fixed child</div>
  55. </div>
  56. <div class="tall"></div>
  57. </div>
  58. <handle size_target="#document"/>
  59. </body>
  60. </rml>