대단한 동현 블로그
반응형

어이 당신. 혹시 nextjs에서 styled-component를 사용하기 위해 죄다 use client를 박고 있지 않은가?

용기를 가지고 tailwindcss로 마이그레이션을 진행하다 reset css가 둘이 달라서 레이아웃이 다 뭉개지지 않는가?

바로 그게 접니다.

 

tailwind의 base layer에서 초기화 해주지만 reset css와 스타일이 조금씩 다르다

때문에 base를 재적용하고 덮어씌웠다

<css />
/* global.css */ @tailwind base; @tailwind components; @tailwind utilities; @layer base { /* Reset styles */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ""; content: none; } table { border-collapse: collapse; border-spacing: 0; }

그리고 런타임에 적용되는 styled-component의 globalStyle에서 때리는 ${reset}은

https://meyerweb.com/eric/tools/css/reset/

 

CSS Tools: Reset CSS

CSS Tools: Reset CSS The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on. The general reasoning behind this was discussed in a May 2007 post, if you're inter

meyerweb.com

과 동일하다.

이제 레이아웃 안 뭉개지면서 tailwindcss로 마이그레이션 가능.

내가 20000줄 어치 마이그레이션 하는동안 문제 없었으니 믿고 사용해도 됨

profile

대단한 동현 블로그

@donghyk2

안녕하세요 주니어 프론트엔드 개발자입니다.