position absolute를 하고 가운데 정렬하려 left 0, right 0만하니까 박스를 풀로채우는 문제가 발생하였다.
왼쪽 로고를 클릭해야하는데 가려져서 클릭하는게 불가능했다. z-index로 뒤로넘겨봤는데 아예 배경 뒤로가버렸다.
해결
스택오버플로우에서 추가 css를 알려줘서 추가해보니까 해결할 수있었다.
100px은 너비에 따라 다르니까 변경하면됨
position: absolute;
left: 0;
right: 0;
width: 100px;
margin-right:auto;
margin-right:auto;
How can I center an absolutely positioned element in a div?
I need to place a div (with position:absolute;) element in the center of my window. But I am having problems doing so, because the width is unknown. I tried this. But it needs to be adjusted as the...
stackoverflow.com
반응형
'Frontend > css' 카테고리의 다른 글
SCSS mixin, function example (0) | 2022.12.20 |
---|---|
image drop-shadow filter (0) | 2022.08.04 |
css의 오염방지, 종속 (0) | 2022.05.22 |
fadein animation, keyframe (0) | 2022.04.28 |
normalize.css를 react scss 적용 (0) | 2022.03.09 |