flex_shrink_to_fit_01.rml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <rml>
  2. <head>
  3. <title>Flex - Shrink-to-fit 01</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://drafts.csswg.org/css-flexbox/" />
  6. <link rel="PR #559" href="https://github.com/mikke89/RmlUi/pull/559" />
  7. <meta name="Description" content="Flexboxes in shrink-to-fit contexts should be sized to fit compactly around their contents." />
  8. <style>
  9. .shrink-to-fit {
  10. float: left;
  11. clear: both;
  12. margin: 10px 0;
  13. border: 2px #e8e8e8;
  14. }
  15. .shrink-to-fit.right {
  16. float: right;
  17. clear: none;
  18. }
  19. .outer {
  20. display: flex;
  21. border: 1px red;
  22. padding: 30px;
  23. }
  24. .inner {
  25. border: 1px blue;
  26. padding: 30px;
  27. }
  28. .row-align-start, .row-align-start * {
  29. display: flex;
  30. flex-direction: row;
  31. align-items: flex-start;
  32. }
  33. .column-align-end, .column-align-end * {
  34. display: flex;
  35. flex-direction: column;
  36. align-items: flex-end;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="shrink-to-fit">
  42. Before
  43. <div class="outer">
  44. <div class="inner">Flex</div>
  45. </div>
  46. After
  47. </div>
  48. <div class="shrink-to-fit right">
  49. Before
  50. <div class="outer" style="display: inline-flex">
  51. <div class="inner">Inline-flex</div>
  52. </div>
  53. After
  54. </div>
  55. <div class="shrink-to-fit" style="display: flex; flex-direction: column">
  56. <div style="padding: 42px; background: blue; border: 5px #00ffff">
  57. <div style="display: flex; background: green; padding: 10px; border: 5px #ff00ff">
  58. <div style="width: 10px; height: 10px; background: red; border: 5px #ffff00"></div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="shrink-to-fit row-align-start" style="width: 130px; height: 130px">
  63. <div style="border: 5px yellow">
  64. <div style="border: 5px red; width: 100px; height: 100px">
  65. <div style="border: 5px green">
  66. <div style="border: 5px blue; width: 50px; height: 50px;"></div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="shrink-to-fit right column-align-end" style="width: 130px; height: 130px">
  72. <div style="border: 5px yellow">
  73. <div style="border: 5px red; width: 100px; height: 100px;">
  74. <div style="border: 5px green">
  75. <div style="border: 5px blue; width: 50px; height: 50px;"></div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <handle size_target="#document"/>
  81. </body>
  82. </rml>