喝完一杯,再来一杯。

子元素与父元素等高

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>

  body,html{
    height: 100%;
    padding: 0;
    margin: 0;
  }
  .parent{
    height: 80%;
    position: relative;
    background-color: #007AFF;
  }
  .son{
    width: 500px;
    *height:expression(this.parentNode.offsetHeight + "px");
    background-color: yellow;
    position: absolute;
    top: 0;
    bottom: 0;
  }


</style>
</head>
<body>
   <div class="parent">
      <div class="son">son</div>
   </div>
</body>
</html>

posted @ 2016-10-19 10:46  先人  阅读(460)  评论(0编辑  收藏  举报