z-index Usage

Look again index, index actually found some contraindications and precautions;

Only valid index of positioning elements;

In the case of two overlapping elements:

For siblings:

1:
Positioning ------- consistent
uniform z-index ---------

Order after the cover appeared first appears

2:

------- positioning the positioning element positioned elements overlap not
uniform z-index ---------

------- consistent order

3:

--------- consistent positioning
z-index --------- large value to cover a small value
consistent sequence -------

For father and son element

1: active parent element z-index:
sub-elements parent element covering

2: parent element z-index failure (z-index is not provided or is not positioned):
sub-subject element z-index;

Reproduced in: https: //www.jianshu.com/p/85338f03457f

Guess you like

Origin blog.csdn.net/weixin_34112208/article/details/91303181