我想通过多个背景创建边框并发现了一个问题。我需要对每个背景应用优先级,因为它们中的许多相互重叠。
是否有任何 css 属性可以设置每个背景的 z-index?
left-top-corner(z-index:2) top(repeat-x) right-top-corner(z-index:2)
left(repeat-y)
left-bottom-corner(z-index:2) bottom(repeat-x) right-bottom-corner(z-index:2)
像那样。
类似于:
background-z-index:2,1,2 .. etc.
最佳答案
没有z-index,但是有堆叠顺序。这有点违反直觉,但您指定的第一张图像将在堆叠顺序(与 HTML 元素相反)中位于顶部(后续图像将在其下方)。更多信息在这里:
http://css-tricks.com/stacking-order-of-multiple-backgrounds/
关于CSS:多背景的Z-index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14915542/