gpt4 book ai didi

css - 位置 :relative and overflow:auto problem but cannot use position:relative on containing element ! ! :-(

转载 作者:行者123 更新时间:2023-11-28 15:01:20 25 4
gpt4 key购买 nike

我有一个页面,我需要在 html 和 body 标签中使用 overflow:auto 因为我有一个 position : fixed 元素,为此我必须在 IE 中使用 position : absolute (因此, overflow:auto 摆脱IE 错误)。

该位已排序。

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

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

我该如何解决这个问题?


* 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;
}

请帮忙

最佳答案

有一个技巧,它允许您将绝对定位的元素放在相对元素中。 You may find it useful.

关于css - 位置 :relative and overflow:auto problem but cannot use position:relative on containing element ! ! :-(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1957176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com