shrink_to_fit_01.rml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <rml>
  2. <head>
  3. <title>Shrink-to-fit</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://www.w3.org/TR/CSS21/visudet.html#shrink-to-fit-float" />
  6. <meta name="Description" content="Floating elements, absolutely positioned elements, and inline-block elements should shrink-to-fit when their width is auto." />
  7. <style>
  8. body {
  9. background: #ddd;
  10. color: #444;
  11. }
  12. body > div {
  13. clear: both;
  14. position: relative;
  15. height: 50dp;
  16. }
  17. body > div > * {
  18. border: 2dp #888;
  19. color: black;
  20. background: #ccf;
  21. }
  22. .absolute {
  23. position: absolute;
  24. }
  25. .float {
  26. float: left;
  27. }
  28. .iblock {
  29. display: inline-block;
  30. }
  31. .right {
  32. text-align: right;
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <p>The following boxes should all appear the same, with the background and border tightly packed around the words 'A BOX'.</p>
  38. <div>
  39. <span>A BOX</span>
  40. </div>
  41. <div>
  42. <div class="absolute">A BOX</div>
  43. </div>
  44. <div>
  45. <div class="float">A BOX</div>
  46. </div>
  47. <div>
  48. <span class="float">A BOX</span>
  49. </div>
  50. <div>
  51. <div class="iblock">A BOX</div>
  52. </div>
  53. <div>
  54. <div class="iblock right">A BOX</div>
  55. </div>
  56. </body>
  57. </rml>