Quantcast
Channel: CSSタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8685

position争い〜要素が重なった時は?〜

$
0
0

要素が重なった時に優先順位を決めたい!

2つの要素にpositionをつけた時、思わぬ形で要素が重なってしまう、、

https://gyazo.com/3c01c80fad0dc299c069baf4a7376225

原因、2つの要素にpositionをつけた時には、勝手に優先順位ができるので、優先順位を手で書き込むこと

header{
position: fixed;z-index:10;//z-index:10;を追加
text-align:center;
}

.tweets-comment{
width: 30vw;
background-color: burlywood;
position: relative;z-index:0; ;//z-index:0;を追加
}

結論! z-index:0;の数字が高い 上 z-index:0;の数字が低い 下になります

直りました。。

https://gyazo.com/61361fe8cfce08d8880a2687e055813a


Viewing all articles
Browse latest Browse all 8685

Latest Images

Trending Articles

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>