calc-zero-percent-height.html (804B)
1 <!doctype html> 2 <link rel="help" href="https://www.w3.org/TR/css-values-4/#calc-computed-value"> 3 <link rel="help" href="https://www.w3.org/TR/CSS2/visudet.html#the-height-property"> 4 <link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org"> 5 <link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> 6 <title>0% in calc() should be preserved</title> 7 <script> 8 CSS.registerProperty({ 9 name: '--custom-height', 10 syntax: '<length-percentage>', 11 initialValue: 'calc(0% + 0px)', 12 inherits: false 13 }); 14 </script> 15 <style> 16 .height-filler { 17 height: 100px; 18 } 19 20 .test { 21 width: 100px; 22 height: var(--custom-height); 23 background-color: green; 24 } 25 </style> 26 <p>Test passes if there is a filled green square.</p> 27 <div class="test"> 28 <div class="height-filler"> 29 </div> 30 </div>