18.104.22.168 The third dimension: z-index
You’ve seen that the left, top, right, and bottom properties can specify the X and Y coordinates of an element within the two-dimensional plane of the containing element. The z-index property defines a kind of third dimension: it allows you to specify the stacking order of elements and indicate which of two or more overlapping elements is drawn on top of the others. The z-index property is an integer. The default value is zero, but you may specify positive or negative values. When two or more elements overlap, they are drawn in order from lowest to highest z-index; the element with the highest z-index appears on top of all the others. If overlapping elements have the same z-index, they are drawn in the order in which they appear in the document so that the last overlapping element appears on top.
Note that z-index stacking applies only to sibling elements (i.e., elements that are children of the same container). If two elements that are not siblings overlap, setting their individual z-indexproperties does not allow you to specify which one is on top. Instead, you must specify the z-index property for the two sibling containers of the two overlapping elements.欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/27941.html