float_basic.rml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <rml>
  2. <head>
  3. <title>Floats, block formatting contexts</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://drafts.csswg.org/css2/#bfc-next-to-float" />
  6. <meta name="Description" content="Floated elements should only interact with elements in the same block formatting context. The margin box of floated elements must not overlap with the border box of elements that establish an independent formatting context." />
  7. <style>
  8. body {
  9. background: #ddd;
  10. color: #444;
  11. }
  12. #content {
  13. width: 250dp;
  14. margin: 0 auto;
  15. }
  16. div.float {
  17. float: left;
  18. background-color: #bbb;
  19. border: 1dp #333;
  20. width: 100dp;
  21. height: 100dp;
  22. margin: 5dp;
  23. }
  24. .red {
  25. color: red;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <p>This test makes assumptions about the font properties, that is, it depends on the size of the layed-out text.</p>
  31. <div id="content">
  32. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod.
  33. <div class="float">float: left</div>
  34. <span class="red">This</span> is the first word after the float and should flow next to the float.</p>
  35. <p>This paragraph should flow next to the float.</p>
  36. <hr/>
  37. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod.
  38. <div class="float">float: left</div>
  39. <span class="red">This</span> is the first word after the float and should flow next to the float.</p>
  40. <p style="clear: left;">This paragraph should be below the float as it clears the float.</p>
  41. <hr/>
  42. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod.
  43. <div class="float">float: left</div>
  44. <span class="red">This</span> is the first word after the float and should flow next to the float.</p>
  45. <p style="overflow: auto;">This paragraph establishes a new block formatting context. This paragraph should therefore be placed below the preceding float to avoid overlapping it, but may be placed adjacent to the float if there is sufficient space.</p>
  46. </div>
  47. </body>
  48. </rml>