首页 > 解决方案 > 出现在固定 div 上的模态叠加

问题描述

我正在使用 Tailwind CSS,我在一些 CSS 中遇到了这个问题,其中作为按钮的模态覆盖不会出现在其他设置为fixed.

下面的链接是代码,这里是问题的预览。

https://codesandbox.io/s/tailwind-css-vre8j

div 的边框和标签背景在叠加层之上

我试图设置z-index问题 div 的叠加层和容器,但它忽略了它。

此处的示例是实际页面的精简版。尽可能多地删除它们以显示问题。

标签: htmlcssoverlayz-indextailwind-css

解决方案


您必须让叠加层上的 z-index 大于其他元素上的 z-index。 https://codesandbox.io/s/tailwind-css-hdx75

在这里,您可以看到我使用 z-10 表示“billy bob Junior box”,使用 z-20 表示覆盖层及其包装


推荐阅读