0

我有一个页面,我需要在 html 和 body 标签中使用溢出:自动,因为我有一个位置:固定元素,为此我必须在 IE 中使用位置:绝对(因此,溢出:自动摆脱 IE漏洞)。

该位已排序。

但现在我的问题是我有其他位置:我页面上的相对元素。在我放 *html, body{ overflow : auto;} 的那一刻,那些相对定位的元素表现得很奇怪,并且由于另一个 IE 错误(overflow:auto 和 position:relative 错误)在 IE 中得到了修复。

在我被告知的一般情况下,此错误的解决方法是在“包含元素”中包含 position:relative。但这是不可能的,因为我的包含元素在 IE 中需要一个 position:absolute 才能使固定元素工作。

我该如何解决这个问题?


* html , body { height:100%; overflow : auto;}
* body #fixedelement {position:absolute;} /* for IE */

body > #fixedelement {position:fixed;} /*for firefox etc*/

#relative{
    /* I need to use this but putting position:relative to html or body
    seems not possible coz i need #fixedelement to work in IE */
    position:relative;
}

请帮忙

4

1 回答 1

0

它有一个技巧,它允许您将绝对定位的元素放在相对元素中。您可能会发现它很有用。

于 2009-12-24T07:16:58.517 回答