为什么z-index不工作? [英] Why does z-index not work?

查看:150
本文介绍了为什么z-index不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,如果我正确理解 z-index ,这将是完美的:





我想放置底部图片(标签/卡)下面的div。所以你看不到锋利的边缘。我如何做到这一点?

  z-index:-1 //图像标签/卡



  index:100 //在上面的div上

也不是这样的组合。如何来?

解决方案

z-index 仅适用于具有 position static (例如 position:absolute; position:relative; position:sticky;



>在Firefox中支持,在Safari中加前缀,在旧版本的Chrome中按照自定义标志工作一段时间,Microsoft正在考虑将其添加到Edge浏览器中。


So if I understand z-index correctly, it would be perfect in this situation:

I want to place the bottom image (the tag/card) below the div above it. So you can't see the sharp edges. How do I do this?

z-index:-1 // on the image tag/card

or

z-index:100 // on the div above

doesn't work either. Neither does a combination of anything like this. How come?

解决方案

The z-index property only works on elements with a position value other than static (e.g. position: absolute;, position: relative;, or position: fixed).

There is also position: sticky; that is supported in Firefox, is prefixed in Safari, worked for a time in older versions of Chrome under a custom flag, and is under consideration by Microsoft to add to their Edge browser.

这篇关于为什么z-index不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆