长段从100%高度的容器中流出
我制作了一个居中的页面容器,其高度为 100%,内部有页脚。我的问题是,当我放入太高的元素或太长的文本时,它们将从“#page”容器中流出并流过页脚。使用溢出-y:auto;在“#page”容器上看起来不太好。我希望“#page”容器能够拉伸以容纳更长的元素或文本,但“#page”容器的高度仍然与浏览器窗口的高度相同。一个美观的解决方案将不胜感激。
更新: 这是jsfiddle链接 http://jsfiddle.net/ueP9q/
I made a centered page container that has 100% height with a footer inside it. My problem is that when I put in an element that is too tall or text that is too long, they will flow out of the "#page" container and over the footer. Using overflow-y: auto; on "#page" container doesn't look good. I would prefer the "#page" container to stretch to accommodate longer elements or text but still have the "#page" container's height to be the same as the browser window height. An aesthetically pleasing solution would be appreciated thanks.
UPDATE:
here is the jsfiddle link http://jsfiddle.net/ueP9q/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTML
CSS
参见这个 - http://jsfiddle.net/aniketpant/U5CSv/
刚刚删除了 2您投入的利润。
HTML
CSS
See this one - http://jsfiddle.net/aniketpant/U5CSv/
Just removed the 2 margins you had put.