tor-browser

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

margin-collapse-clear-013.xht (3399B)


      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      2 
      3 <html xmlns="http://www.w3.org/1999/xhtml">
      4 
      5  <head>
      6 
      7   <title>CSS Test: Margin collapsing with clearance - margins of a 'collapsed through' box with clearance do not collapse with parent block's bottom margin</title>
      8 
      9   <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" />
     10   <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#normal-block" />
     11   <link rel="bookmark" href="http://lists.w3.org/Archives/Public/public-css-testsuite/2013Oct/0009.html" title="Issue with margin-collapse-clear-012.htm and margin-collapse-clear-013.htm" />
     12   <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
     13   <link rel="author" title="Bruno Fassino" href="fassino[at]gmail.com" />
     14   <link rel="match" href="margin-collapse-clear-012-ref.xht" />
     15 
     16   <meta content="When an element has had clearance applied to it and its own margins collapse, these margins do not collapse with the bottom margin of the parent block" name="assert" />
     17 
     18   <style type="text/css"><![CDATA[
     19   #rel-pos-wrapper {position: relative;}
     20 
     21   #parent-lime
     22   {
     23   background-color: lime;
     24   border-top: black solid 1px;
     25   width: 50%;
     26   }
     27 
     28   #float-left-blue
     29   {
     30   background-color: blue;
     31   float: left;
     32   height: 100px;
     33   width: 100px;
     34   }
     35 
     36   #clear-left
     37   {
     38   clear: left;
     39   margin-bottom: 140px;
     40   margin-top: 40px;
     41   }
     42 
     43   #next-yellow
     44   {
     45   background-color: yellow;
     46   height: 100px;
     47   }
     48 
     49   .ref-overlapped-red
     50   {
     51   background-color: red;
     52   position: absolute;
     53   z-index: -1;
     54   }
     55 
     56   #ref1
     57   {
     58   height: 200px;
     59   top: 1px;
     60   width: 50%;
     61   }
     62 
     63   #ref2
     64   {
     65   height: 100px;
     66   top: 201px;
     67   width: 100%;
     68   }
     69   ]]></style>
     70 
     71  </head>
     72 
     73  <body>
     74 
     75   <p>Test passes if there is <strong>no red</strong>.</p>
     76 
     77   <div id="rel-pos-wrapper">
     78 
     79   <!--
     80 
     81      clearance
     82    +
     83      margin-top of #clear-left (40px)
     84    ====================================
     85      height of #float-left-blue (100px)
     86 
     87      therefore, clearance is equal to +60px
     88 
     89   -->
     90 
     91   <!--
     92 
     93   #parent-lime should have height 200px, sum of:
     94 
     95     100px          : height of #float-left-blue
     96   +
     97     (140px - 40px) : part of #clear-left's margin-bottom
     98                      exceeding #clear-left's margin-top
     99   =======
    100    200px
    101 
    102   The position of the top border edge of the div#clear-left
    103   is where it would have been if the element had a
    104   non-zero bottom border. The margins of div#clear-left
    105   collapse together to 140px and the top border edge of
    106   div#clear-left is at 40px inside of it. Clearance is
    107   added at such position, not to the whole 140px.
    108 
    109   Issue with margin-collapse-clear-012.htm and margin-collapse-clear-013.htm
    110   http://lists.w3.org/Archives/Public/public-css-testsuite/2013Oct/0012.html
    111 
    112   -->
    113 
    114     <div id="parent-lime">
    115       <div id="float-left-blue"></div>
    116       <div id="clear-left"></div>
    117     </div>
    118 
    119    <!--
    120    #next-yellow should immediately follow #parent-lime (no margins in between)
    121    -->
    122 
    123     <div id="next-yellow"></div>
    124 
    125    <!--
    126    #ref1 and #ref2 boxes create a sort of 'reference rendering'
    127    where #ref1 should be covered, overlapped by #parent-lime
    128    while #ref2 should be covered, overlapped by #next-yellow.
    129    -->
    130 
    131     <div id="ref1" class="ref-overlapped-red"></div>
    132     <div id="ref2" class="ref-overlapped-red"></div>
    133 
    134   </div>
    135 
    136  </body>
    137 </html>