Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 논리연산자
- 타입
- 조건문
- for in
- flex-wrap
- 함수표현식
- javascript
- 기초
- 프론트엔드
- 함수선언식
- if else
- ELSE
- 속성
- Methods
- 함수
- typeof
- align-content
- flex-direction
- boolean
- frontend
- for
- for of
- 변수
- 화살표함수
- 문자열
- 반복문
- flex
- properties
- 비교연산자
- justify-content
Archives
- Today
- Total
하얀 코딩
[Styled Component - 9] styled-reset 본문
styled-reset은 리액트 애플리케이션에서 사용되는 스타일 라이브러리인
"styled-components"와 함께 사용되는 패키지 중 하나입니다.
스타일드 컴포넌트는 CSS를 컴포넌트 기반으로 작성할 수 있게 해주는 라이브러리이며,
styled-reset은 초기 CSS 스타일을 재설정하여 브라우저 간의 일관된 스타일링을 적용하는 데 도움을 줍니다.
설치
npm install styled-reset
적용 예시
import { createGlobalStyle } from 'styled-components';
import reset from 'styled-reset';
const GlobalStyle = createGlobalStyle`
${reset}
/* 이곳에 추가적인 전역 스타일을 설정할 수 있습니다 */
`;
function App() {
return (
<>
<GlobalStyle />
{/* 나머지 컴포넌트들 */}
</>
);
}
이렇게 하면 styled-reset이 제공하는 초기 스타일이 GlobalStyle 컴포넌트 내에 적용되어,
모든 HTML 요소들의 초기 스타일이 리셋되고 브라우저 간 일관된 시작점을 갖게 됩니다.
이후에는 스타일드 컴포넌트를 사용하여 컴포넌트마다 필요한 스타일을 정의할 수 있습니다.
'Styled Components' 카테고리의 다른 글
[Styled Component - 8] createGlobalStyle (0) | 2023.08.30 |
---|---|
[Styled Component - 7] & (1) | 2023.06.05 |
[Styled Component - 6] ThemeProvider (0) | 2023.06.05 |
[Styled Component - 5] keyframes (0) | 2023.06.05 |
[Styled Component - 3] attrs (0) | 2023.06.02 |