为什么z-index忽略与position:static? [英] Why is z-index ignored with position:static?

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

问题描述

查看此评论

// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned



我看到jquery的 zIndex()返回0 if元素是 position:static

I see that jquery's zIndex() returns 0 if the element is position: static.

position:static不支持z-index (它适用于我在Chrome,没有测试跨浏览器)

Isn't z-index supported on position:static? (It works for me in Chrome, haven't tested cross-browser)

推荐答案

因为 static 表示忽略左侧顶部 z-index 等。

'z-index'
Value:      auto | <integer> | inherit
Initial:    auto
Applies to:     positioned elements

- http://www.w3.org/TR/CSS21/visuren.html#z-index


如果一个元素的position属性的值不是static,则称为定位。

An element is said to be positioned if its 'position' property has a value other than 'static'.

- http:// www.w3.org/TR/CSS21/visuren.html#positioned-element

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

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