:ledger: 리액트의 reset css 라이브러리인 the-new-css-reset을 사용해보자.

팀 과제를 진행하던 중 초기 세팅하며 reset css를 항상 복붙해왔는데, 리액트에서 제공하는 라이브러리가 있다고 같은 조원이 알려줘서 배우게 되었다. 정~말 간단한 방법이어서 정리해봤다.

:one: 리셋 코드

아래는 해당 라이브러리의 리셋 코드입니다.

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/
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;
}

:two: 라이브러리 설치 방법

터미널에 아래의 명령어를 입력.

// yarn
yarn add the-new-css-reset

// npm
npm i the-new-css-reset

:three: import 방법

아래의 코드를 main.jsx에서 import 해준다.

import "the-new-css-reset/css/reset.css";

:fire: 마무리

해당 라이브러리의 마지막 업데이트가 11년도긴 하지만, styled-component를 사용하고 있기에 간편하게 전역으로 reset을 해주었다. 물론 부족한 부분도 있겠지만, 간편하게 사용하기엔 정말 좋은 라이브러리이다.