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>

 

posted @ 2013-08-21 17:14  Bella_li  阅读(135)  评论(0)    收藏  举报