목록으로

tailwind layer

약 1분 읽기Development#Development댓글로 이동

layer 체크

main
date
Aug 15, 2025
slug
tailwind-layer
author
status
Public
tags
Development
summary
layer 체크
type
Post
thumbnail
category
Development
updatedAt
Oct 12, 2025 01:10 PM

@tailwind base

기본 스타일 정의
브라우저의 기본 스타일을 재정의 → 프로젝트 전반에 걸쳐 일관된 기본 스타일 적용
/* base.css */ @tailwind base; @layer base { body { font-family: 'Inter', sans-serif; background-color: #f7fafc; color: #2d3748; } h1, h2, h3, h4, h5, h6 { font-weight: 600; } }
 

@tailwind components

재사용 가능한 컴포넌트 정의
버튼, 카드, 모달 등과 같은 UI 컴포넌트를 정의 → 프로젝트 내 여러 위치에서 반복적 사용
/* components.css */ @tailwind components; @layer components { .btn { @apply px-4 py-2 bg-blue-500 text-white rounded-md; } .card { @apply p-4 shadow-md rounded-lg bg-white; } }
 

@tailwind components

작은 유틸리티 클래스들을 정의
tailwind 기본 제공 유틸리티 외에도 사용자 정의 유틸리티 추가 → 단일 스타일 속성 정의, 조합하여 스타일 구성
/* utilities.css */ @tailwind utilities; @layer utilities { .bg-brand { background-color: #3490dc; } .text-brand { color: #3490dc; } .border-brand { border-color: #3490dc; } }
 
클래스 우선 순위 base > components > utilities 순으로 override