@apply는 Tailwind CSS 유틸리티 클래스를 재사용 가능한 커스텀 스타일로 그룹화할 때 사용됩니다.
/* index.css */
.btn-primary {
@apply bg-blue-500 text-white font-bold py-2 px-4 rounded;
}
.btn-secondary {
@apply bg-gray-500 text-white py-2 px-4 rounded;
}
const ButtonExample = () => (
<div>
<button className="btn-primary">Primary Button</button>
<button className="btn-secondary">Secondary Button</button>
</div>
);
export default ButtonExample;
.btn-primary:hover {
@apply bg-blue-700;
}
.responsive-card {
@apply p-4 md:p-8 lg:p-12;
}
viewport, viewBox 비교 (0) | 2025.01.07 |
---|---|
text-anchor (2) | 2025.01.07 |
Audio 자동 플레이 설정 - React.js (3) | 2024.11.26 |
width 를 min() 으로 설정하기 (0) | 2024.11.25 |
video, iframe 비교 (0) | 2024.11.21 |