gpt4 book ai didi

css 绝对定位在 Windows 和 mac 之间的 FF/chrome 上不同

转载 作者:太空宇宙 更新时间:2023-11-03 19:21:46 27 4
gpt4 key购买 nike

我正在使用以下测试。在我的 mac 上的 firefox/chrome/safari 中,panel1 呈现在 panel2 之上。但是在我的 Windows 机器上的 firefox/chrome 上,它呈现在下面。

我希望 panel1 直接放置在 panel2 之上。正确的做法是什么?:

<html>

<head>
</head>

<body>

<!-- Appears on top of panel2 in safari/chrome/ff on mac, but underneath on windows. -->
<div id='panel1' style='z-index:6; position:absolute; width:100px; height:100px; background-color:red'>
</div>

<div id='panel2' style='z-index:3; width:100px; height:100px; background-color:yellow'>
</div>

</body>

</html>

我在上一个问题中看到了这个技巧。我无法设置 panel1 的顶部/左侧位置(我认为),因为它位于一个更大的 div 嵌套中,当用户调整其浏览器框架大小时,它会在屏幕上移动。

谢谢

------------更新------------

尝试在两个 div 上显式设置 z-index,成功了。

最佳答案

    <div id='panel2' style='z-index:3; width:100px; height:100px; background-color:yellow'>
</div>

<div id='panel1' style='z-index:5; position:absolute; width:100px; height:100px; background-color:red'>
</div>

也许像这样?交换 2 的位置。

关于css 绝对定位在 Windows 和 mac 之间的 FF/chrome 上不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3384020/

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