Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            - /css/CSS2/floats-clear/float-non-replaced-height-001.xht - WPT Dashboard Interop Dashboard
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <head>
        <title>CSS Test: Floated non-replaced element with 'margin-top', margin-bottom' set to 'auto' and 'height' relying on the descendants</title>
        <link rel="match" href="float-non-replaced-height-001-ref.xht" />
        <meta name="assert" content="If 'height' is 'auto' on an floated non-replaced element then the 'height' depends on the descendants." />
        <style type="text/css">
            #div1
            {
                position: relative;
            }
            #div2
            {
                background: blue;
                float: left;
            }
            #div2 div, #div3
            {
                height: 1in;
                width: 1in;
            }
            #div3
            {
                background: orange;
                left: 1in;
                position: absolute;
                top: 0;
            }
        </style>
    </head>
    <body>
        <p>Test passes if the blue and orange squares have the same height.</p>
        <div id="div1">
            <div id="div2">
                <div></div>
            </div>
            <div id="div3"></div>
        </div>
    </body>
</html>