absolute-non-replaced-max-height-009

Max-height on absolutely positioned, non-replaced elements, height is shrink-to-fit

WeasyPrint

This browser

Flags
ahem
Assertion
The 'height' is based on the content height, 'auto' values for 'margin-top' and 'margin-bottom' are set to '0' when 'height' and 'bottom' are 'auto' and 'top' is not 'auto'.

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 on absolutely positioned, non-replaced elements, height is shrink-to-fit</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#abs-non-replaced-height">
 7         <meta name="flags" content="ahem">
 8         <meta name="assert" content="The 'height' is based on the content height, 'auto' values for 'margin-top' and 'margin-bottom' are set to '0' when 'height' and 'bottom' are 'auto' and 'top' is not 'auto'.">
 9         <style type="text/css">
10             #div1
11             {
12                 position: relative;
13             }
14             #div2
15             {
16                 background: blue;
17                 height: 0.5in;
18                 left: 1in;
19                 position: absolute;
20                 top: 0.25in;
21                 width: 1in;
22             }
23             #div3
24             {
25                 background: orange;
26                 bottom: auto;
27                 font: 1in/1em Ahem;
28                 height: auto;
29                 margin-bottom: auto;
30                 margin-top: auto;
31                 max-height: 0.5in;
32                 position: absolute;
33                 top: 0.25in;
34                 width: 1in;
35             }
36         </style>
37     </head>
38     <body>
39         <p>Test passes if the orange and blue boxes below are the same height.</p>
40         <div id="div1">
41             <div id="div2"></div>
42             <div id="div3">&nbsp;</div>
43         </div>
44     </body>
45 </html>