如题
html:
<body>
<div class="app">
<div class="box"></div>
<div class="box2"></div>
</div>
</body>
<style type="text/css">
html,body{
width: 100%;
height: auto;
margin:0;
padding: 0;
}
.app{
height: 100%;
}
.box{
width: 100%;
height: 400px;
background-color: red;
}
.box2{
width: 100%;
/*这里的height无效*/
height: 100%;
background-color: blue;
}
</style>
本意是想让app的高度被撑开为400px,从而使得box2中设置height: 100%,使box2高度也变成400px,
但是box2高度却是0,感到费解,求高手指教。