calc-min-height.html (2130B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Values and Units Test: calc() function in 'min-height' and 'box-sizing: border-box' (complex)</title> 6 7 <!-- 8 9 Original test is: 10 11 https://chromium.googlesource.com/chromium/src/+/c825d655f6aaf73484f9d56e9012793f5b9668cc/third_party/WebKit/LayoutTests/css3/calc/calc-min-height.html 12 13 The original test is related to: 14 15 Issue 580508: Height of content changes after multiple reloads 16 https://bugs.chromium.org/p/chromium/issues/detail?id=580508 17 18 --> 19 20 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> 21 <link rel="help" href="https://www.w3.org/TR/css-values-3/#calc-notation"> 22 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 23 24 <meta name="assert" content="This test checks how 'min-height' with calc(percentage) and 'box-sizing' are handled. The percentage in the calc() is calculated on the content box height of div#container."> 25 26 <style> 27 div#container 28 { 29 border-bottom: transparent solid 100px; 30 border-right: transparent solid 100px; 31 height: 400px; 32 width: 100px; 33 } 34 35 div#item 36 { 37 background-color: red; 38 box-sizing: border-box; 39 height: 50px; 40 min-height: calc(50% - 100px); 41 } 42 43 div#item > div 44 { 45 background-color: green; 46 border-bottom: green solid 34px; /* arbitrary border-bottom-width value */ 47 border-top: green solid 12px; /* arbitrary border-top-width value */ 48 box-sizing: border-box; 49 height: 17px; 50 min-height: 100%; /* content height should be 100px - 34px - 12px == 54px */ 51 overflow-y: visible; 52 /* 53 If the content height of innermost div is taller 54 than 54px, then a green rectangle (not a square) 55 will be created. 56 57 If the content height of innermost div is less 58 than 54px, then an horizontal stripe of red 59 will become visible. 60 */ 61 } 62 </style> 63 64 <p>Test passes if there is a filled green square and <strong>no red</strong>. 65 66 <div id="container"> 67 68 <div id="item"> 69 70 <div></div> 71 72 </div> 73 74 </div>