overflow_hidden.rml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <rml>
  2. <head>
  3. <title>Overflow: hidden</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="match" href="reference/overflow_hidden-ref.rml"/>
  6. <link rel="help" href="https://www.w3.org/TR/CSS21/visufx.html#propdef-overflow" />
  7. <link rel="GitHub issue" href="https://github.com/mikke89/RmlUi/issues/116" />
  8. <meta name="Description" content="Nesting divs should still hide overflow. Elements whose containing block is located above the 'overflow: hidden' element should be visible." />
  9. <meta name="See also" content="CSS 2.1 'clipping-' and 'overflow-' tests." />
  10. <style>
  11. body {
  12. display: block;
  13. background: #ddd;
  14. color: #444;
  15. }
  16. div.overflow {
  17. border: 1dp black;
  18. overflow: hidden;
  19. width: 200dp;
  20. height: 120dp;
  21. margin: 10dp 0;
  22. }
  23. div.relative {
  24. position: relative;
  25. }
  26. div.clip-always {
  27. clip: always;
  28. }
  29. div.clip-none {
  30. clip: none;
  31. }
  32. div.wide {
  33. width: 300dp;
  34. height: 20dp;
  35. color: #f00;
  36. text-align: right;
  37. background-color: #aaa;
  38. }
  39. div.absolute {
  40. position: absolute;
  41. top: 100dp;
  42. left: 250dp;
  43. width: 80dp;
  44. height: 80dp;
  45. }
  46. div.close {
  47. top: 20dp;
  48. left: 250dp;
  49. }
  50. .green { background-color: #7f7; }
  51. .red { background-color: #f77; }
  52. </style>
  53. </head>
  54. <body>
  55. <p>There should be a green box, no red visible, and the word 'fail' should not appear.</p>
  56. <div class="overflow">
  57. <div>
  58. <div class="wide">FAIL</div>
  59. LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
  60. <!-- This should be visible as the containing block should be 'body' which is above 'div.overflow'. -->
  61. <div class="absolute green">Should be visible</div>
  62. </div>
  63. </div>
  64. <div class="overflow relative">
  65. <div>
  66. <div class="wide">FAIL</div>
  67. LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
  68. <!-- This should not be visible as the containing block should now be 'div.overflow' since it uses position: relative. -->
  69. <div class="absolute red">Should not be visible</div>
  70. </div>
  71. </div>
  72. <div class="overflow">
  73. <span>
  74. LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
  75. </span>
  76. <div>
  77. LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
  78. </div>
  79. </div>
  80. <div class="overflow relative">
  81. LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD&nbsp;FAIL
  82. <div class="absolute close red" style="top: 0">Should not be visible</div>
  83. <div class="clip-none">
  84. Don't clip within a clipping parent using 'clip: none'.
  85. LONG_WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORD
  86. <div class="absolute close green clip-none">Should be visible</div>
  87. </div>
  88. </div>
  89. <div class="overflow relative clip-always">
  90. Force clipping even though contents don't overflow using 'clip: always'.
  91. <div>
  92. <div class="absolute close red">Should not be visible</div>
  93. </div>
  94. </div>
  95. </body>
  96. </rml>