네이버 오디오클립 main-left, main-right, footer, 오디오 카테고리 페이지
github소스코드
top
으로 변경해서 사용했다..audio-section .audio-body {
position: relative;
padding-top: 19px;
}
.audio-body .btn {
display: none;
position: absolute;
width: 44px;
height: 44px;
background-color: olive;
border-radius: 50%;
top: 50%;
transform: translateY(-50%);
}
.audio-body:hover .btn {
display: initial;
}
.audio-body .btn.btn-left {
left: -22px;
}
.audio-body .btn.btn-right {
right: -22px;
}
/* section마다 버튼 위치 조정 */
.audio-section .audio-body .btn {
top: 80px;
}
.audio-section .audio-body {
position: relative
}
.audio-section .audio-body ul {
align-items: flex-start;
}
.audio-section .audio-body li {
width: 120px;
}
.audio-section .audio-body li a img {
width: 100%;
height: 120px;
border-radius: 10px;
}
.audio-section .audio-body li a h3 {
margin-top: 10px;
font-size: 13px;
}
.audio-section .audio-body li a .author {
margin-top: 6px;
font-size: 12px;
color: #959595;
}
position:absolute
를 이용해 위치를 조정했다.#audio-playlist .audio-header .link-total {
position: absolute;
padding: 10px 18px 8px;
background-color: #fff;
border: 1px solid rgba(0,0,0,.1);
border-radius: 20px;
box-shadow: 0 2px 10px 0 rgb(80 85 91 / 7%);
font-size: 13px;
font-weight: 500;
color: #157efb;
top: 6px;
right: 0;
}
#audio-live li a .img-wrap {
/* overflow: hidden; */
position: relative;
width: 120px;
height: 120px;
border: solid 2px lightgray;
border-radius: 50%;
}
#audio-live li.active a .img-wrap {
border: solid 2px red;
}
#audio-live li a .img-wrap img {
width: 100%;
height: 100%;
border: solid 2px #fff;
border-radius: 50%;
}
#audio-live li a .img-wrap .live-state {
position: absolute;
padding: 2px;
border-radius: 3px;
background-color: #fff;
left: 50%;
transform: translateX(-50%);
bottom: -11px;
}
#audio-live li a .img-wrap .live-state .live {
display: block;
padding: 2px 4px;
border: solid 2px red;
border-radius: 3px;
color: red;
font-size: 10px;
font-weight: 700;
letter-spacing: 1px;
}
#audio-live li.active a .img-wrap .live-state .live {
border: solid 2px red;
background-color: red;
color: #fff;
}
inline-block
속성은 margin: 0 auto
로 중앙정렬 안 됨. block 속성으로 바꿔서 x축 한 줄 전부 차지한 후 그 안에서#audio-discovery .audio-body .btn-more {
display: block;
margin: 0 auto;
}
flex-between
, wrap
으로 형제 태그들을 정렬할 때, 각 줄에 오는 요소의 개수가 다르면 레이아웃이 틀어진다. 그럴 땐 flex-start
로 왼쪽으로 몰고 개체 사이 간격을 지정해서 정렬할 수 있다.nth-child()
선택자 활용: odd
(홀수), even
(짝수) 등. 여러 가지 선택자를 사용해 배경색을 다양하게 넣어보았다.#audio-main .audio-category .audio-category-lists li:nth-child(6n) {
margin-right: 0;
}
#audio-main .audio-category .audio-category-lists li:nth-child(even) a {
background-color: rgb(230, 125, 127);
}
#audio-main .audio-category .audio-category-lists li:nth-child(4n+1) a {
background-color: rgb(225, 187, 114);
}
#audio-main .audio-category .audio-category-lists a {
position: relative;
overflow: hidden;
display: block;
width: 100%;
height: 100%;
background-color: rgb(133, 134, 247);
border-radius: 6px;
padding: 14px;
}
오늘은 특히 표준 클래스를 많이 만들고 사용했다. 그래서 강의 내용은 많았지만 내용에 비해 시간이 좀 적게 걸린 느낌이다. 여러 곳에 적용할 수 있는 코드를 잘 만들어서 좀 더 효율적인 코딩을 하고 싶다.