扩展超出容器div的子div [英] Extend child div beyond container div
问题描述
我试图用浏览器的宽度扩展这个div。我已阅读
这里
,你可以使用 {position:absolute; left:0; right:0;}
来实现,就像在jsfiddle中一样:
http:// jsfiddle。 net / bJbgJ / 3 /
但问题是我目前的 #container
code> {position:relative;} 属性,因此如果我将 {position:absolute}
只能参考 #container
。有没有办法仍然延伸我的孩子潜水超过 #container
?
我可以想出五种可能达成目标的方法:
-
在内部元素上使用负边距移动
-
使用Javascript将内部元素移动到父元素之外。
p>更改源代码并将父元素移动到父元素之外。 -
使用
position:fixed
在内部元素。 -
删除
code> position:relative; 从父元素或给父元素position:static
I'm trying to expand this div across with width of the browser. I've read from
here
that you can use {position:absolute; left: 0; right:0;}
to achieve that as in the jsfiddle here:
http://jsfiddle.net/bJbgJ/3/
But the problem is that my current #container
has a {position:relative;}
property, and hence if I apply {position:absolute}
to the child div, it would only refer to #container
. Is there a way to still extend my child dive beyond the #container
?
I can think of five ways to potentially accomplish your goal:
Use negative margins on the inner element to move it outside of the parent
Use Javascript to move the inner element outside of the parent.
Change the source code and move the inner element outside of the parent.
Use
position: fixed
on the inner element. This will allow the inner element to break out but has the down side that the element will be fixed at the given position (never moving).Remove the
position: relative;
from the parent element or give the parent element aposition: static
这篇关于扩展超出容器div的子div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!