tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

flexbox-min-width-auto-001.html (3873B)


      1 <!DOCTYPE html>
      2 <!--
      3     Any copyright is dedicated to the Public Domain.
      4     http://creativecommons.org/publicdomain/zero/1.0/
      5 -->
      6 <html>
      7  <head>
      8    <meta charset="utf-8">
      9    <title>CSS Test: Testing min-width:auto</title>
     10    <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
     11    <link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#min-size-auto">
     12    <link rel="match" href="flexbox-min-width-auto-001-ref.html">
     13 <!--
     14     This testcase tests the used value of "min-width:auto" (the property's
     15     initial value) on flex items in a horizontal flex container.
     16 
     17     It's supposed to resolve to the smallest of:
     18      a) The used 'flex-basis' (taken from 'width'), if 'flex-basis' is at its
     19         initial value.
     20      b) The computed 'max-width' property
     21      c) If there's no intrinsic aspect ratio: the item's min-content width.
     22      d) If there is an intrinsic aspect ratio: the item's width derived from
     23         the ratio & constraints in the other dimension.
     24 
     25    We measure what the used value is by putting flex items in a small flex
     26    container, which will shrink its items down to their min-width.
     27 
     28    This test checks for situations where we should resolve the min-width as
     29    (a), (b), or (c) above. Another test will check (d).
     30 -->
     31    <style>
     32      .flexbox {
     33        display: flex;
     34        width: 1px;  /* No available space; shrink flex items to min-width */
     35        margin-bottom: 2px; /* (Just for spacing things out, visually) */
     36      }
     37 
     38      .flexbox > * {
     39        /* Flex items have purple border: */
     40        border: 2px dotted purple;
     41      }
     42 
     43      .flexbox > * > * {
     44        /* Flex items' contents are gray & fixed-size: */
     45        background: gray;
     46        height: 10px;
     47        width: 80px;
     48      }
     49    </style>
     50  </head>
     51  <body>
     52    <!-- Check for min-width:auto resolving correctly when the smallest
     53         candidate value is: -->
     54    <!-- *** (a) Used 'flex-basis' (from 'width') *** -->
     55    <!-- First, without definite max-width: -->
     56    <div class="flexbox">
     57      <div style="width: 50px"><div></div></div>
     58    </div>
     59    <!-- ...and now with definite (& large) 'max-width': -->
     60    <div class="flexbox">
     61      <div style="width: 50px; max-width: 120px;"><div></div></div>
     62    </div>
     63    <!-- ...and now with used 'flex-basis' being a calc expression:-->
     64    <div class="flexbox">
     65      <div style="width: calc(10% + 50px)"><div></div></div>
     66    </div>
     67 
     68    <!-- *** (b) The computed 'max-width' *** -->
     69    <!-- First, with a larger candidate 'flex-basis' value (from 'width') -->
     70    <div class="flexbox">
     71      <div style="width: 100px; max-width:50px"><div></div></div>
     72    </div>
     73    <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't
     74         be considered for 'min-width:auto' anyway) -->
     75    <div class="flexbox">
     76      <div style="flex-basis: 100px; max-width:50px"><div></div></div>
     77    </div>
     78    <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't
     79         be considered for 'min-width:auto' anyway) -->
     80    <div class="flexbox">
     81      <div style="flex-basis: 10px; max-width:50px"><div></div></div>
     82    </div>
     83 
     84    <!-- *** (c) (no intrinsic aspect ratio) The min-content size *** -->
     85    <!-- First, with a larger candidate 'flex-basis' value (from 'width') -->
     86    <div class="flexbox">
     87      <div style="width: 100px"><div></div></div>
     88    </div>
     89    <!-- ...and now with a larger explicit 'flex-basis' value (which shouldn't
     90         be considered for 'min-width:auto' anyway) -->
     91    <div class="flexbox">
     92      <div style="flex-basis: 100px"><div></div></div>
     93    </div>
     94    <!-- ...and now with a smaller explicit 'flex-basis' value (which shouldn't
     95         be considered for 'min-width:auto' anyway) -->
     96    <div class="flexbox">
     97      <div style="flex-basis: 10px"><div></div></div>
     98    </div>
     99  </body>
    100 </html>