HTML CSS ::BEFORE 위치 질문드립니다. 채택완료
Copy
테스트
ㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱ
ㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴ
ㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷ
Copy
.pd { counter-reset: colorcircle 0; }
.pd > li { position: relative; list-style: none; padding-left: 3rem; }
.pd > li+li { margin-top: 1.2rem }
.pd > li::before { position: absolute; top: 50%; left: 0.5rem; transform: translateY(-50%); counter-increment: colorcircle 1; content: counter(colorcircle); color: #fff; font-size: 1.5rem; z-index: 1; }
.pd > li::after { content: ''; position: absolute; top: 50%; left: 0; transform: translateY(-50%); display: inline-block; background-color: #f54; border-radius: 50%; width: 1.1em; height: 1.2em; }
[캡처 사진]

before, after 로 구성한 카운터 넘버링의 위치가 <li></li> 전체 중앙에 자리잡는데 이것을, 맨 위 텍스트에 위치를 못시키나요??
답변 1개
채택된 답변
+20 포인트
1년 전
Copy
.pd { counter-reset: colorcircle 0; }
.pd > li { position: relative; list-style: none; padding-left: 3rem; }
.pd > li+li { margin-top: 1.2rem }
.pd > li::before { position: absolute; top: 50%; left: 0.5rem; transform: translateY(-50%); counter-increment: colorcircle 1; content: counter(colorcircle); color: #fff; font-size: 1.5rem; z-index: 1; }
.pd > li::after { content: ''; position: absolute; top: 50%; left: 0; transform: translateY(-50%); display: inline-block; background-color: #f54; border-radius: 50%; width: 1.1em; height: 1.2em; }
.pd > li::before, .pd > li::after {
top: calc(1.5rem * 0.5);
}
테스트
ㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱㄱ
ㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴ
ㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷ
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인