如何让内部 div 溢出父级?
请参考此: 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置中间 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.