制作浮动div填充容器?

发布于 2024-12-25 04:39:44 字数 191 浏览 3 评论 0原文

尝试让浮动 div 填充其父级的高度,但 #sidebar 似乎不想扩展到超过 auto

示例如下: http://jsfiddle.net/FDQKm/

有什么建议吗?

Trying to get a floating div to fill the height of its parent, but the #sidebar doesn't seem to want to expand past auto.

Example here: http://jsfiddle.net/FDQKm/

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少女的英雄梦 2025-01-01 04:39:44

身高:100% 从来没有对我有用过。我一直所做的就是通过将“overflow:hidden”应用于父div(在您的情况下是main),然后添加“padding-bottom:5000px;”,使div看起来为全高。边距底部:-5000px;”我试图让 div 看起来全高。这将扩展恰好存在的任何背景和侧边框,就好像该元素实际上是父 div 的完整高度一样。

Height:100% has never worked for me. What I've always done is made divs appear to be full height by applying "overflow:hidden" to the parent div (main in your case), and then adding a "padding-bottom:5000px;margin-bottom:-5000px;" to the div I'm trying to make look full height. This will extend any backgrounds and side borders that happen to be there, as if the element was actually the full height of the parent div.

来日方长 2025-01-01 04:39:44

使父 div 位置=相对,然后调整内部 div 的大小。
内部 div 的高度应为:height:100%

make the parent div position= relative and then resize your inner div.
height of the inner div should be : height:100%

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文