max-height-percentage-002

Percentage 'max-height' with no 'height' on containing block

WeasyPrint

This browser

Assertion
When the 'height' of the containing block is not specified and the element is not absolutely positioned the percentage is treated as '0' for 'min-height' and 'none' for 'max-height'.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3     <head>
 4         <title>CSS Test: Percentage 'max-height' with no 'height' on containing block</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="When the 'height' of the containing block is not specified and the element is not absolutely positioned the percentage is treated as '0' for 'min-height' and 'none' for 'max-height'.">
 9         <style type="text/css">
10             #div1
11             {
12                 position: relative;
13             }
14             div div
15             {
16                 width: 1in;
17             }
18             #div2
19             {
20                 background: blue;
21                 height: 2in;
22                 max-height: 50%;
23             }
24             #div3
25             {
26                 background: orange;
27                 height: 2in;
28                 left: 1in;
29                 position: absolute;
30                 top: 0;
31             }
32         </style>
33     </head>
34     <body>
35         <p>Test passes if the blue and orange boxes below are the same height.</p>
36         <div id="div1">
37             <div id="div2"></div>
38             <div id="div3"></div>
39         </div>
40     </body>
41 </html>