tip-archive
tip-archive copied to clipboard
z-index 정리
Description
<div id="foo">
foo
</div>
<div id="bar">
bar
</div>
<styles>
#foo {
z-index: 2;
}
#bar {
position: fixed
}
<styles>
#foo
의 z-index가 #bar
보다 커도 적용이 되지 않는다. #bar
가 position이 fixed
(or absolute
)이기 때문이다. 따라서 #foo
에 position: relative
를 적용해준다.
<styles>
#foo {
position: relative
z-index: 2;
}
#bar {
position: fixed
}
<styles>