1

我有 2 个绝对定位的 div 彼此上方。

  • z-index:0 的 div;包含网站的导航。
  • z-index:1 的 div;位于另一个 div 的顶部,使导航不可见。

当 div 不可见时,菜单项仍然可以点击,这怎么可能?

4

1 回答 1

1

Does the div with z-index 1 have a background?

By default, background-colors are set to "transparent" but IE reads them as invisible when z-indexed. This means that if your div with z-index: 1 doesn't have a background, IE basically pretends it isn't there.

You can hack this by setting the background to some phony url like,

background: url(not_a.gif)

as I found from this this forum. The same solution is also shown in a another example involving links.

于 2013-04-08T22:03:49.383 回答