当我尝试在子div上设置height: 100%时,高度仍然保持为0。
这是父div:
游戏内容的高度也是100%(不是0)。尽管游戏包装器的高度保持为0,但宽度确实有效。我做错了什么?
这是父div:
#game-content {
margin-top: 50px;
overflow: auto;
height: 100%;
width: 100%;
}
#game-wrapper {
float: left;
margin-left: 90px;
position: relative;
height: 100%;
}
<div id="game-content">
<div id="game-wrapper">
<div class="game">
<img class="game-element" src="http://placehold.it/200x200" />
<div class="game-element" id="description">
<h4 id="game-header">Game1</h4>
Desc
</div>
</div>
</div>
</div>
html,body {height:100%}
。 - Stickersheight: 100vh
。 - Stickers