LoginSignup
0
0

More than 3 years have passed since last update.

一般的な対処法をしてもz-indexが効かない(ように見える)

Last updated at Posted at 2020-03-24

正確に言うと効いてるんだけど効いてないように見えるという話。

z-indexが効かないときの一般的な対処法

  • z-index以外の要因で重ね合わせコンテクストの変更が行われている
  • 親要素のz-indexに影響を受けている
  • positionがstatic

概ねこのあたりだと思うのですが、私は上記いずれを試してもz-indexの効果が確認されず、重ね合わせた時にz-indexの低い要素が高い要素の上に位置していました(るように見えました。)

原因

background-colorの初期値はtransparentなのですが、この値は実は透過色で要素が重なり合った時に下位の要素が視認できてしまいます。
私はデフォルトの背景色は白色だと思っていたので微妙にハマってしまいました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0