12345

<!DOCTYPE html>

<html>

    <head>

        <title>让孩子与父节点等高</title>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <style>

            html,body{

                height:100%;

                 margin: 0;

                 padding: 0;

            }

            .parent{

                  position: relative;

                background:violet;

                height: 90%;

            }



            .son{

                *height:expression(this.parentNode.offsetHeight + "px");

                position: absolute;

                top:0px;

                bottom: 0px;

                width:800px;

                background: red;

            }

        </style>

    </head>

    <body>

        <div class="parent">

              <div class="son">TODO write content</div>

        </div>

      

   </body>

</html>

 

你可能感兴趣的:(12345)