
TailwindCSS는 Preflight라는 내장 CSS reset 시스템을 제공한다:
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
html, body {
margin: 0;
padding: 0;
}
}
텍스트 콘텐츠가 많은 프로젝트용:
npm i @tailwindcss/typography
외부 HTML 콘텐츠에 기본 스타일 복원:
.unreset {
a {
@apply text-blue-700 underline;
}
p {
@apply my-4;
}
}
/* globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
// app/layout.tsx
import './globals.css'
export default function RootLayout({ children }) {
return (
<html lang="ko">
<body>{children}</body>
</html>
)
}
// tailwind.config.js
module.exports = {
corePlugins: {
preflight: false,
},
}
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
html {
font-family: 'Noto Sans KR', system-ui, sans-serif;
}
body {
@apply text-gray-900 bg-white;
}
button:focus,
input:focus {
@apply outline-none ring-2 ring-blue-500;
}
}
@layer components {
.unreset {
@apply [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4;
@apply [&_p]:mb-4;
@apply [&_ul]:list-disc [&_ul]:pl-5;
@apply [&_a]:text-blue-600 [&_a]:underline;
}
}
TailwindCSS는 다른 CSS 프레임워크와 달리 자체적으로 강력한 reset 시스템을 내장하고 있어, 대부분의 경우 추가적인 reset 라이브러리가 필요하지 않다는 것이 가장 큰 특징이다.