리액트 폰트 추가하기 GlobalStyle, reset css

developer.do·2023년 3월 26일
0

reset 적용하는법

import { createGlobalStyle } from "styled-components";
import Router from "./routes/Router";

const GlobalStyle = createGlobalStyle` // 먼저 GlobaclStyle 변수를 만들어준다.
`;

export const App = () => {
  return (
    <>
      <GlobalStyle /> // 여기처럼 추가하면 끝
      <Router />
    </>
  );
};
  1. 아래의 내용을 복붙한다.
import { css, createGlobalStyle } from 'styled-components'

// prettier-ignore
export const reset = css`
/* http://meyerweb.com/eric/tools/css/reset/
   v5.0.1 | 20191019
   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, menu, 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,
main, 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, main, menu, nav, section {
  display: block;
}
/* HTML5 hidden-attribute fix for newer browsers */
*[hidden] {
    display: none;
}
body {
  line-height: 1;
}
menu, 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;
}
`

export const Reset = createGlobalStyle`${reset}`

export default reset

폰트추가하는법
1. 구글 폰트의 import를 복사

const GlobalStyle = createGlobalStyle`
@import url('https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Delicious+Handrawn&family=Nanum+Brush+Script&family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');
// 여기에 복붙을 해주고


body {
  line-height: 1;
  font-family: 'Delicious Handrawn', cursive;
}

//body 부분에 font-family를 넣어주면 끝

0개의 댓글