티스토리 뷰
부모의 z-index 레벨을 점검해 본다.
<section class="content">
<div class="modal"></div>
</section>
<div class="side-tab"></div>
.content {
position: relative;
z-index: 1;
}
.modal {
position: fixed;
z-index: 100;
}
.side-tab {
position: fixed;
z-index: 5;
}
[원인]
modal의 z-index가 100이라도, 부모인 content의 z-index가 1이면 side-tab은 modal의 위에 배치될수밖에 없다.
이유는 마크업에서 같은 레벨의 부모의 z-index 값이 낮으면 자식의 값도 강제로 값이 낮아지기 때문이다.
(z-index를 100해봐야 content 안에서만 100이라는 의미)
[해결 방법 2가지]
- modal을 content 밖으로 뺀다.
- content의 position을 제거해서 modal의 z-index를 제한하지 않게 한다.
올라탄 요소에 opacity, transform속성이 있는지 체크해 본다.
z-index가 작동하지 않는 대상에게 아래의 속성을 사용한다.
z-index: 10;
position: relative;
[공부 좌표]
'이론 > CSS' 카테고리의 다른 글
[CSS] Q. flex에 justify-items와 justify-self는 없나요? (0) | 2021.03.09 |
---|---|
[CSS] Q. align-content와 align-items의 차이 (0) | 2021.03.09 |
[CSS] background-size (0) | 2021.03.04 |
[CSS] clip-path, clip (0) | 2021.03.01 |
[CSS] font 축약 속성 (0) | 2021.02.16 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- innerHeight
- 일치 연산자
- 동치 연산자
- constructor
- scrollHeight
- scrollTop
- __proto__
- offsetTop
- 부등 연산자
- property
- clinetTop
- 불일치 연산자
- @font-face
- javascript class
- clientHeight
- 링크막기 #a링크막기
- outerHeight
- 객체의 프로퍼티
- 프로퍼티
- 동등 연산자
- 점 표기법
- offsetHeight
- prototype 프로퍼티
- [[Prototype]]
- 대괄포 표기법
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함