[英]div positioning problem
In FireFox 3.5, the following div does not push the page content down. 在FireFox 3.5中,以下div不会将页面内容下推。 Rather, it overlaps.
相反,它重叠。 IE 8 does not.
IE 8没有。 What can I do as a quick fix?
快速修复该怎么办?
<div style="position:fixed;top:0;width:100%;">blah blah</div>
position: fixed means, that the div should stay absolute to the view point (to the browser window). position:固定意味着div应该绝对保持在视点(浏览器窗口)内。 You can use for real absolute positioning:
您可以使用真正的绝对定位:
position: absolute;
It should overlap, position:fixed does that. 它应该重叠,position:fixed可以重叠。 Switch it to static or remove position.
将其切换到静态或移除位置。 In both cases top becomes meaningless.
在这两种情况下,top都变得毫无意义。
Position fixed: You can set the elements location by setting top right bottom and left. 固定位置:您可以通过设置右上角的底部和左侧来设置元素的位置。 This will contain distance from the browsers border.
这将包含距浏览器边界的距离。 Position absolute: The same but now top right bottom and left will need the distance from the first parent which has "position: relative".
绝对位置:相同,但现在右上角的底部和左侧将需要与具有“ position:relative”的第一个父代之间的距离。
应该是“绝对”,而不是“固定”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.