85%的高度意味着父母身高的85%.由于您没有为外部div指定任何高度,因此其高度为0px,因此0的85%为0.
指定父级的高度,或者在px,em,rem等中指定内部div的高度.
#outer {
width: 100px;
height: 100px;
background: red;
}
#inner {
width: 100px;
height: 50%;
background: green;
}
I'm just another element
85%的高度意味着父母身高的85%.由于您没有为外部div指定任何高度,因此其高度为0px,因此0的85%为0.
指定父级的高度,或者在px,em,rem等中指定内部div的高度.
#outer {
width: 100px;
height: 100px;
background: red;
}
#inner {
width: 100px;
height: 50%;
background: green;
}
I'm just another element