flex_04.rml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <rml>
  2. <head>
  3. <title>Flex 04 - Flex shorthand</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-property" />
  6. <meta name="Description" content="The default value of flex should allow the items to shrink but not grow. With 'flex: auto' the items should fill the container and also allow shrinking. With 'flex: none' the items neither shrink nor grow with the container size. Finally, with 'flex: &amp;lt;number&amp;gt;' each item should be given that proportion of the available space." />
  7. <meta name="Instructions" content="Resize the document to see the resizing behavior of the flexboxes." />
  8. <style>
  9. h1 {
  10. text-align: center;
  11. margin-bottom: 5dp;
  12. padding: 0.25em 0;
  13. border-color: #aaa;
  14. border-width: 1dp 0;
  15. }
  16. h1:first-child { margin-top: 0; }
  17. h1, h2 { white-space: nowrap; }
  18. .flex {
  19. display: flex;
  20. margin: 3dp 0 7dp;
  21. border: 2dp #333;
  22. overflow: hidden;
  23. justify-content: space-around;
  24. align-items: flex-end;
  25. flex-wrap: wrap;
  26. }
  27. .flex > div {
  28. border: 2dp #d66;
  29. background: #fff;
  30. text-align: center;
  31. }
  32. .flex.nowrap {
  33. flex-wrap: nowrap;
  34. }
  35. .flex.auto > div {
  36. flex: 1 1 auto;
  37. }
  38. .flex.none > div {
  39. flex: none;
  40. }
  41. .flex.number > div {
  42. flex: 1;
  43. }
  44. .wrapper {
  45. min-height: 165dp;
  46. }
  47. </style>
  48. </head>
  49. <body>
  50. <h1>flex: <em>default value</em> (0 1 auto)</h1>
  51. <div class="wrapper">
  52. <h2>flex-wrap: wrap</h2>
  53. <div class="flex">
  54. <div>Hello</div>
  55. <div>big world!</div>
  56. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  57. </div>
  58. <h2>flex-wrap: nowrap</h2>
  59. <div class="flex nowrap">
  60. <div>Hello</div>
  61. <div>big world!</div>
  62. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  63. </div>
  64. </div>
  65. <h1>flex: auto (1 1 auto)</h1>
  66. <div class="wrapper">
  67. <h2>flex-wrap: wrap</h2>
  68. <div class="flex auto">
  69. <div>Hello</div>
  70. <div>big world!</div>
  71. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  72. </div>
  73. <h2>flex-wrap: nowrap</h2>
  74. <div class="flex nowrap auto">
  75. <div>Hello</div>
  76. <div>big world!</div>
  77. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  78. </div>
  79. </div>
  80. <h1>flex: none (0 0 auto)</h1>
  81. <div class="wrapper">
  82. <h2>flex-wrap: wrap</h2>
  83. <div class="flex none">
  84. <div>Hello</div>
  85. <div>big world!</div>
  86. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  87. </div>
  88. <h2>flex-wrap: nowrap</h2>
  89. <div class="flex nowrap none">
  90. <div>Hello</div>
  91. <div>big world!</div>
  92. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  93. </div>
  94. </div>
  95. <h1>flex: 1 (1 1 0)</h1>
  96. <div class="wrapper">
  97. <h2>flex-wrap: wrap</h2>
  98. <div class="flex number">
  99. <div>Hello</div>
  100. <div>big world!</div>
  101. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  102. </div>
  103. <h2>flex-wrap: nowrap</h2>
  104. <div class="flex nowrap number">
  105. <div>Hello</div>
  106. <div>big world!</div>
  107. <div>LOOOOOOOOOOOOOOOOOOOOONG</div>
  108. </div>
  109. </div>
  110. <handle size_target="#document"/>
  111. </body>
  112. </rml>