키워드
Reset CSS
box-sizing 속성
word-break 속성
Theme
ThemeProvider
브라우저마다 초깃값이 달랏었기 때문에, 초기화하는 기법이 생겼다.
패키지 설치.
App 컴포넌트에서 사용.
import { Reset } from 'styled-reset';
export default function App() {
return (
<>
<Reset />
<Greeting />
</>
);
}
전역 스타일 지정.
import { createGlobalStyle } from 'styled-components';
const GlobalStyle = createGlobalStyle`
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
html {
font-size: 62.5%;
}
body {
font-size: 1.6rem;
}
:lang(ko) {
h1, h2, h3 {
word-break: keep-all;
}
}
`;
export default GlobalStyle;
import { Reset } from 'styled-reset';
import GlobalStyle from './styles/GlobalStyle';
export default function App() {
return (
<>
<Reset />
<GlobalStyle />
<Greeting />
</>
);
}