100% CSS 布局,带页眉和页脚
我正在尝试创建一个带有页眉和页脚(两者都有固定高度)的布局,以及它们之间的内容 div 填充剩余空间。在 content-div 中,我想要具有基于百分比值的高度的 div(以 content-div 的 heihgt 作为父级)。我不知道该怎么做?
I'm trying to create a layout with a header and footer (both of which have a fixed heights) and a content-div between them that is fills the remaining space. Within the content-div I want to have divs with heights that are based on percent values (with the content-div's heihgt as parent). I can't figure out how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于页脚粘在屏幕底部或内容底部(以距离顶部较远者为准)的解决方案,请查看 Ryan Fait 的“粘性页脚”。它是一个轻量级且强大的 CSS,通常是您想要的布局。
http://ryanfait.com/sticky-footer/
For a solution where the footer sticks to the bottom of the screen or the bottom of the content (whichever is further from the top), check out Ryan Fait's "sticky footer". It's a lightweight and robust handful of CSS, and it's usually what you want for your layout.
http://ryanfait.com/sticky-footer/
[查看实际操作]
[See it in action]