如何让内部 div 溢出父级?

发布于 2025-01-05 08:12:44 字数 269 浏览 2 评论 0原文

请参考此: http://jsfiddle.net/k8c7w/

我正在尝试获取中间灰色带(那个写着“HELLO WORLD!”)延伸到整个屏幕。但是,请注意 main 具有非常明确的宽度。

有人知道我该如何解决这个问题吗?主 div 的宽度需要在所有页面上保持标准,所以我根本不想摆弄它,而其他 2 个带(红色带)需要保持与现在相同的大小。

感谢堆栈溢出! 林檎

Please refer to this: http://jsfiddle.net/k8c7w/

I am trying to get the middle grey band (the one that says "HELLO WORLD!") to stretch across the entire screen. however, note that main has a very defined width.

Anyone know how I can fix this? The width of the main div needs to remain standard across all pages so I don't want to fiddle with that at all, and the other 2 bands (red bands) need to stay the same size as they are now.

Thanks StackOverflow!
Ringo

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

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

发布评论

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

评论(1

唠甜嗑 2025-01-12 08:12:44

设置中间 div 的宽度...

此处演示

如果您想从中删除滚动条外部 div,然后从 .main 中删除溢出属性。 (如上面小提琴中的第二组)

除非使用此方法,如果您不想指定中间 div 的宽度,则必须删除包含的 div 并指定 .one< 的宽度/code> 类,而不是 .main. 类。

Set a width for the middle div...

demo here

If you want to remove the scroll from the outer div, then remove the overflow property from .main. (as in the second set in the fiddle above)

Barring this method, if you don't want to specify a width for the middle div, you'd have to remove the containing div and specify width for the .one class as opposed to the .main. class.

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