max-height-percentage-001

Max-height percentage is based on containing block

WeasyPrint

This browser

Assertion
A percentage for 'max-height' is calculated with respect to the 'height' of the generated boxes containing block.

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: Max-height percentage is based 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="A percentage for 'max-height' is calculated with respect to the 'height' of the generated boxes containing block.">
 9         <style type="text/css">
10             #div1
11             {
12                 height: 2in;
13                 position: relative;
14             }
15             div div
16             {
17                 width: 1in;
18             }
19             #div2
20             {
21                 background: blue;
22                 height: 2in;
23                 max-height: 50%;
24             }
25             #div3
26             {
27                 background: orange;
28                 height: 1in;
29                 left: 1in;
30                 position: absolute;
31                 top: 0;
32             }
33         </style>
34     </head>
35     <body>
36         <p>Test passes if the blue and orange boxes below are the same height.</p>
37         <div id="div1">
38             <div id="div2"></div>
39             <div id="div3"></div>
40         </div>
41     </body>
42 </html>