简体   繁体   English

CSS高度:100%无法正常工作

[英]CSS height:100% not working properly

What I want to achieve: When re-sized to mobile view the fly-out navigation should be 100% height, make the div "nav" 100% height of the page regardless of content inside the div "main". 我想要实现的目标:调整大小以移动视图时,弹出导航的高度应为100%,无论div“ main”中的内容如何,​​将div“ nav”设置为页面的100%高度。

I have tried setting the html, body to 100% height. 我尝试将html正文设置为100%高度。 The wrappers are also at 100% height, but it is not working. 包装纸也处于100%的高度,但无法正常工作。

here is my code sample: 这是我的代码示例:

http://codepen.io/anon/pen/GHJqh/ http://codepen.io/anon/pen/GHJqh/

You need to assign height:100% to both the html and body for your solution to work. 您需要为html和body分配height:100%才能使解决方案正常工作。 I've also applied it to the outer-wrap but I believe you may need a better solution as this would mess up a sticky footer if you are doing one. 我也将其应用于外包装,但我相信您可能需要更好的解决方案,因为如果您这样做,则会弄乱脚注。

CODEPEN CODEPEN

http://codepen.io/anon/pen/DAfoe/ http://codepen.io/anon/pen/DAfoe/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM