이런문제가 발생하는원인 : inline CSS가 우선순위가 더 높아서 그렇다.
해결방법 : CSS파일에다가 !important 쓰면 된다
<Link href={`/products/artworkmanagement`}>
<div className={styles.titlesText} style={{color: router.pathname == `/products/artworkmanagement` ? "#9449F5" : "#000"}}>
{t('nav.inventory')}
</div>
</Link>
.titlesText{
color: #777;
font-family: Pretendard;
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: normal;
white-space: nowrap;
transition: color 0.3s;
}
.titlesText:hover{
color: #9449F5 !important;
transition: color 0.3s;
}
'코딩' 카테고리의 다른 글
props를 하위 컴포넌트에서 상위 컴포넌트로 보내는 방법 (0) | 2025.03.10 |
---|---|
파일을 다운로드하게 만드는 handler (1) | 2025.03.06 |
react-progress-bar로 프로그레스 바 만들기 (0) | 2025.03.04 |
Swiper를 사용해서, 슬라이드 만드는 법 (0) | 2025.03.03 |
keyframes로 자동으로 움직이는 Carousel 만드는 법 (0) | 2025.03.02 |
댓글