shrink_to_fit_02.rml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <rml>
  2. <head>
  3. <title>Shrink-to-fit 2</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="Shrink-to-fit width with differently positioned and floated boxes." />
  7. <style>
  8. body {
  9. background: #ddd;
  10. color: #444;
  11. }
  12. hr {
  13. margin-top: 15dp;
  14. margin-bottom: 15dp;
  15. background-color: #ccc;
  16. }
  17. div {
  18. border: 2dp #444;
  19. background: #ccf;
  20. }
  21. body > div {
  22. display: inline-block;
  23. position: relative;
  24. /*overflow: auto;*/
  25. }
  26. body > div > div {
  27. width: 150dp;
  28. height: 30dp;
  29. background: #cfc;
  30. }
  31. .absolute {
  32. position: absolute;
  33. top: 20dp;
  34. left: 50dp;
  35. }
  36. .relative {
  37. position: relative;
  38. top: 20dp;
  39. left: 50dp;
  40. }
  41. .float-left {
  42. float: left;
  43. }
  44. .float-right {
  45. float: right;
  46. }
  47. </style>
  48. </head>
  49. <body>
  50. <div>
  51. Some text
  52. <div>Block</div>
  53. Text after
  54. </div>
  55. <hr/>
  56. <div>
  57. Some text
  58. <div class="absolute">Absolute</div>
  59. Text after
  60. </div>
  61. <hr style="margin-top: 55dp;"/>
  62. <div>
  63. Some text
  64. <div class="relative">Relative</div>
  65. Text after
  66. </div>
  67. <hr/>
  68. <div>
  69. Some text
  70. <div class="float-left">Float left</div>
  71. Text after
  72. </div>
  73. <hr/>
  74. <div>
  75. Some text
  76. <div class="float-right">Float right</div>
  77. Text after
  78. </div>
  79. <hr/>
  80. <div>
  81. <div class="float-left">Float left</div>
  82. Text after
  83. </div>
  84. <hr/>
  85. <div>
  86. <div class="float-right">Float right</div>
  87. Text after
  88. </div>
  89. <hr/>
  90. <div>
  91. Some text
  92. <div class="float-left relative">Float relative</div>
  93. Text after
  94. </div>
  95. </body>
  96. </rml>