position:相对容器bug中的绝对值 [英] position:absolute in a relative container bug

查看:111
本文介绍了position:相对容器bug中的绝对值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我有一个问题是定位一些我希望锚定到现有表格单元格的图片但是我不能在单元格上放置常规位置,因为背景是固定高度而且图片集大于固定空间。所以我把它们放在一个位置:绝对div我给了一个位置:相对于容器td。

这似乎在IE中工作但在Firefox位置是相对于浏览器窗口,而不是单元格。我需要一个兼容的解决方案来锚定这个垂直的图片集相对于布局的特定区域而不是一般的浏览器窗口叹息...

这是完整的HTML代码(粗体代码是为了什么我指的是)以及一些css样式编码,以防万一。

hello , I have an issue positionating some pics I want to anchor to an existing table cell but I cant just place regular position on the cell because the background is fixed height and the set of pics is bigger then fixed space. SO I put them in a position:absolute div and I gave a position:relative to the container td.
This seems to work in IE but in Firefox position is relative to the browser window, not the cell. I need a compatible solution to anchor this vertical set of pics relatively to a specific area of the layout not the general browser window sigh...
Here is the complete html code (the bold code is for what I''m referring to) and also some of the css style coding, just in case.

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号

推荐答案


你好,我有一个问题定位一些我要锚定到现有表格单元格的图片,但我不能放置常规posi在单元格上,因为背景是固定的高度,并且图片集大于固定空间。所以我把它们放在一个位置:绝对div我给了一个位置:相对于容器td。

这似乎在IE中工作但在Firefox位置是相对于浏览器窗口,而不是单元格。我需要一个兼容的解决方案来锚定这个垂直的图片集相对于布局的特定区域而不是一般的浏览器窗口叹息...

...
hello , I have an issue positionating some pics I want to anchor to an existing table cell but I cant just place regular position on the cell because the background is fixed height and the set of pics is bigger then fixed space. SO I put them in a position:absolute div and I gave a position:relative to the container td.
This seems to work in IE but in Firefox position is relative to the browser window, not the cell. I need a compatible solution to anchor this vertical set of pics relatively to a specific area of the layout not the general browser window sigh...
...



我也有同样的错误。我尝试了一个更简单的代码,它在IE中工作但不在Firefox中。

I too have the same bug. I tried on a simpler code and it worked in IE but not in firefox.

展开 | 选择 | Wrap | 行号


我现在非常忙我为无法深入查看代码而道歉。问题可能是IE。 IE扩展容器以包含浮动和绝对定位的元素。这是不正确的行为。但要让现代浏览器做你想做的事,请尝试添加overflow:auto;到包含元素,看看是否修复它。


我会稍后再试一次。
I am extremely busy right now so I apologize for not being able to look at the code in depth. The problem is probably IE. IE expands containers to contain floated and absolutely positioned elements. This is incorrect behavior. But to get modern browsers to do what you want, try adding overflow:auto; to the containing element and see if that fixes it.

I''ll try and look into this again later.



我非常现在很忙,所以我为无法深入查看代码而道歉。问题可能是IE。 IE扩展容器以包含浮动和绝对定位的元素。这是不正确的行为。但要让现代浏览器做你想做的事,请尝试添加overflow:auto;到包含元素,看看是否修复它。


我会稍后再试一次。
I am extremely busy right now so I apologize for not being able to look at the code in depth. The problem is probably IE. IE expands containers to contain floated and absolutely positioned elements. This is incorrect behavior. But to get modern browsers to do what you want, try adding overflow:auto; to the containing element and see if that fixes it.

I''ll try and look into this again later.



我有类似的代码,Safari和& IE没有任何问题 - 似乎FireFox不合适。在我的情况下,具有相对位置的表包含具有绝对位置的表;如果你申请top:0px对于后者,FireFox认为这是错误的 - 意味着浏览器窗口的顶部,而不是包含元素的顶部。

I have similar code which Safari & IE have no trouble with - it seems to be FireFox out of line. In mine, a table with relative position contains a table with absolute postion; if you apply "top: 0px" to the latter, FireFox takes this - wrongly - to mean the top of the browser window, not the top of the containing element.


这篇关于position:相对容器bug中的绝对值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆