如何使子 div 成为位置绝对父容器的 100% 高度

J.D*_*Doe 5 html css

如何使子 div 成为位置绝对固定父容器的 100% 高度?

HTML

<div class="parent">
  <div class="child">
  </div>
</div> 
Run Code Online (Sandbox Code Playgroud)

CSS

.parent {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0; 
}
Run Code Online (Sandbox Code Playgroud)

小智 0

对子 div 使用 100% 高度,例如

.Child{
height:100%;
}
Run Code Online (Sandbox Code Playgroud)