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 | 29 | 30 |
Tags
- 인접 형제 결합자
- reveal in file explorer
- html tag i
- background-color 속성
- go live
- padding 속성
- RGB
- focus 의사클래스
- html
- i 태그
- RGBA
- Live Server
- sub태그
- tag html
- width속성
- 아두이노
- html 태그
- 일반 형제 결합자
- id 선택자
- sup태그
- css
- Checked 의사 클래스
- br 태그
- 자식결합자
- not 의사클래스
- height속성
- iframe 태그
- iframe
- 전체 선택자
- 임베디드
Archives
- Today
- Total
so woon!
[React] CSS 적용하기 본문
학습일 : 2023. 03. 16
css 적용을 위한 두가지 선택지가 있다.
방법1
src 폴더 안에 css (styles.css 라고 만들었음.) 파일을 만든다.
index.js로 가서
import "./styles.css";
라고 import 해주어야 한다.
<index.js>
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import "./styles.css";
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
이렇게 작성해주고 나서
<styles.css>
button {
color:white;
background-color: tomato;
}
button:hover{
background-color: blue;
}
이렇게 작성해주면
이렇게 css가 잘 적용됨을 볼 수 있다.
방법2
[React] 동일한 css 속성을 다른 파일 내에서 사용하기
학습일 : 2023. 03. 16 css 적용을 하며 같은 class 중복문제와 또 그걸 피하기 위해 다른 이름의 class 를 주고 같은 코드를 그대로 긁어 와서 사용했던 아주 비효율적이고 찝찝했던 지난날의 무거운 고
xowoony.tistory.com
구롬이만
'ReactJS > 개념정리' 카테고리의 다른 글
[React] useEffect (0) | 2023.03.16 |
---|---|
[React] 동일한 css 속성을 다른 파일 내에서 사용하기 (0) | 2023.03.16 |
[React] propTypes 설치하기 (0) | 2023.03.16 |
[React] 관계성 살펴보기 (0) | 2023.03.16 |
[React] import (0) | 2023.03.15 |
Comments