创建具有可变垂直高度的 div
根据所附屏幕截图:
我想创建一个
位于距离顶部“x”像素的位置,但本质上是垂直“扩展”以适应给定选项卡中的任何内容,以及水平方向纯色整个页面的宽度。本质上是一个忽略其他
的
。屏幕截图更好地解释了我的意思。如何制作这样的
布局?as per screenshot attached:
I want to create a <div>
that is positioned "x" pixels from the top, but essentially "expands" vertically to fit whatever is in a given tab as well as horizontally the width of the whole page with a solid colour. Essentially a <div>
that ignores the other <div>
's. Screenshot explains what I mean better. How do I make such a <div>
layout?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
粘性页脚向我显示您正在寻找的内容。这意味着您的内容区域可以是整个屏幕,或者如果有更多内容,则适合内容。页脚位于屏幕底部或内容底部
http://www.cssstickyfooter.com/< /a>
或在 Stack Overflow 上搜索 Stickyfooter
和 abit of html 来帮助您入门
http://jsbin.com/emufot/8/
A sticky footer looks to me what you are looking for. This means you have a content area that is either the entire screen or if it has more contents, fits the content. The footer is either on the bottom of the screen or on the bottom of the content
http://www.cssstickyfooter.com/
or search for stickyfooter on Stack Overflow
And abit of html to get you started
http://jsbin.com/emufot/8/
标准 CSS 应该为您完成这项工作,就好像您没有为 div 设置高度一样,它会自动扩展以适合其内容。这是我快速敲出的一些代码,它将显示这个想法:
只需将“lorerm ipsum etc”内容替换为您想要看到的包含 div 更改大小的内容即可。
祝你好运。
Standard CSS should do the job for you as if you don't set a height for a div, it will automatically expand to fit its content. Here is some code I knocked up quickly which will display the idea:
Just replace the 'lorerm ipsum etc' content with whatever you want to see the containing div change size.
Good Luck.