728x90
반응형
export const GameTitle = styled.span` // 게임 이름
${font.h3_medium};
width: max-content; // 글자가 있는 만큼만 width를 갖게 된다. (!!!)
transition: all 0.8s;
&::after { // 게임 이름에 밑줄, 원래는 투명한 상태
display: block;
content: "";
border-bottom: solid 1px white;
opacity: 0;
}
`;
export const GameVideo = styled.div` // 이미지랑 버튼 등 넣는 틀(?)
position: relative;
width: 285px;
height: 180px;
overflow: hidden;
border-radius: 4px;
`;
export const GameImg = styled.img`
width: 100%;
height: 100%;
object-fit: cover;
transition: all 0.8s;
`;
export const PlayBtn = styled.div`
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 72px;
height: 72px;
flex-grow: 0;
border-radius: 100%;
padding: 14px;
opacity: 0.6;
background: ${root.black};
svg {
width: 44px;
height: 44px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
`;
export const GameBox = styled.div` // 게임 하나를 감싸는 틀
&:hover {
cursor: pointer;
${GameImg} {
transform: scale(1.2);
}
${GameTitle}::after {
opacity: 1;
transition: all 0.8s;
}
${PlayBtn} {
background: linear-gradient(135deg, #007ff4 0%, #6f00c6 100%);
}
}
display: flex;
flex-direction: column;
gap: 10px;
transition: all 0.8s;
`;
원하는 것) GameBox라는 전체 틀의 어디에든 마우스를 올리면 게임 제목은 밑줄이 생기고, 게임 이미지는 확대되게 하기
밑줄은 hover시에 border-bottom으로 하면 나왔다 안 나왔다하면서 덜그럭 거린다..
이 분 블로그를 참고해서 opacity로 바꿔서 적용했다.
https://kindkimyoung.tistory.com/28
[html&css] 메뉴 hover시 밑줄 트랜지션 a태그 display:block; after활용
메뉴 텍스트에 마우스를 over 했을 때 밑줄이 있길 바라는 작업지시서를 받았습니다. hover 밑줄 이펙트는 검색하면 어디에든 많이 나오긴 합니다. 찬찬히 둘러보면서 어느 위치에 어떤 속성을 줄
kindkimyoung.tistory.com
728x90
반응형
'프론트엔드✏️ > 개인공부' 카테고리의 다른 글
[react, query] 좋아요의 상태가 이상했던 이유 (0) | 2022.10.17 |
---|---|
[css] 가상 요소, hover transition, 그라디언트 transition 주기 (0) | 2022.10.13 |
[원티드] 프리온보딩 SPA Router 구현하기 (0) | 2022.10.07 |
[Next.js] Next.js 설치 (1) | 2022.10.07 |
[react] Modal 스크롤 막기 (0) | 2022.10.05 |