티스토리 뷰
position absolute는 가장가까운 relative 를 가진 부모 기준으로 움직인다.
.nav__notification {
background-color: tomato;
width: 30px;
height: 30px;
border-radius: 15px;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: 600;
position: absolute;
right: 5px;
}
위의 문제점?
position absolute가 적용이 body에 되버려서 body기준으로 right 5px인것
position relative를 그럼 그위의 부모에다가 적용을 또시켜야됨
=> 적용시키니 위치가 변경됨
.nav__link {
position: relative;
color: black;
}
.nav__notification {
background-color: tomato;
width: 30px;
height: 30px;
border-radius: 15px;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: 600;
position: absolute;
left: 15px;
bottom: 15px;
}
'CSS' 카테고리의 다른 글
[CSS]li속성 정렬, 줄간격 맞추기, 단락의 두 번째 줄부터 들여 쓰기 (0) | 2022.06.22 |
---|---|
[CSS] Grid 레이아웃 공부2 Template areas, auto-fit, min-max (0) | 2022.01.14 |
[CSS] Grid 레이아웃 공부 (0) | 2022.01.14 |
twittler 만들어보기(와이어프레임 설계, 구조잡기) (0) | 2021.10.21 |
css : 기본 문법과 flexbox (0) | 2021.10.21 |