z-index not working with fixed positioning

后端 未结 8 1283
广开言路
广开言路 2020-11-22 03:46

I have a div with default positioning (i.e. position:static) and a div with a fixed position.

If I set the z-index

8条回答
  •  滥情空心
    2020-11-22 04:21

    z-index only works within a particular context i.e. relative, fixed or absolute position.

    z-index for a relative div has nothing to do with the z-index of an absolutely or fixed div.

    EDIT This is an incomplete answer. This answer provides false information. Please review @Dansingerman's comment and example below.

提交回复
热议问题