fieldset-block-size.html (1272B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://html.spec.whatwg.org/C/#the-fieldset-and-legend-elements"> 3 <!-- A test for the following paragraph: 4 For the purpose of calculating the used 'block-size', if the computed 5 'block-size' is not 'auto', the space allocated for the rendered legend's 6 margin box that spills out past the border, if any, is expected to be 7 subtracted from the 'block-size'. If the content box's block-size would be 8 negative, then let the content box's block-size be zero instead. 9 --> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <style> 13 fieldset { 14 margin: 0; 15 padding: 0; 16 border: 2px solid black; 17 } 18 legend { 19 height: 102px; 20 background-color: yellow; 21 } 22 .content { 23 background-color: lime; 24 } 25 </style> 26 <fieldset style="block-size: 200px;"> 27 <legend>Legend</legend> 28 <div class="content" style="height:100%"></div> 29 </fieldset> 30 31 <fieldset style="block-size: 40px;"> 32 <legend>Legend</legend> 33 <div class="content" style="height:100%"></div> 34 </fieldset> 35 36 <script> 37 test(() => { 38 let cs = document.querySelectorAll('.content'); 39 assert_equals(cs[0].offsetHeight, Math.max(202 - 102, 0)); 40 assert_equals(cs[1].offsetHeight, Math.max(42 - 102, 0)); 41 }, 'Test content\'s block-size'); 42 </script>