jquery - 为什么 z-index 被位置 :static? 忽略

标签 jquery html css z-index

查看此评论 from jquery-ui

// 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

我看到如果元素是 position: static,jquery 的 zIndex() 返回 0。

position:static 不支持 z-index 吗? (它在 Chrome 中对我有用,还没有测试过跨浏览器)

最佳答案

因为position: static的意思是“忽略所有从left,top,z-index开始的定位指令等等。”

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

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

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

关于jquery - 为什么 z-index 被位置 :static? 忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8486475/

相关文章:

css - 宽度 = 父级宽度 CSS3

jquery snap 可拖动到包装器

javascript - 在回发时维护 asp.net mvc 中的表单位置(提交)

javascript - JavaScript 中的 "On file dialog cancel"事件

css - 为什么我的可滚动 div 在 Bootstrap 模式中不起作用?

css - 我的页面内容与 IE7 中的下拉菜单重叠

html - 使用 CSS 在 HTML 元素的一 Angular 左侧和下方均匀阴影

jquery - 如何使用 JQuery+JEditable 一次编辑/保存多个字段?

jquery - 销毁 jquery 函数和我的对象之间的绑定(bind)?

css - 创建 5 个 DIV,中间有 1 个 DIV