๐ CSS Selector
CSS ํด๋์ค๊ฐ ํน์ ํด๋์ค ๋ด๋ถ์ ์๋ ๊ฒฝ์ฐ์๋ง ์คํ์ผ์ ์ ์ฉํ ์ ์๋ค.
.App .logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
}
/* App.css */
/* ์ฐ์ CSS ํ์ผ์ ์ด๋ ๊ฒ ์์ ํ๊ณ ... */
.App {
text-align: center;
}
/*.App ์์ ๋ค์ด ์๋ .logo*/
.App .logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
}
/* .App ์์ ๋ค์ด ์๋ header
header ํด๋์ค๊ฐ ์๋ header ํ๊ทธ ์์ฒด์
์คํ์ผ์ ์ ์ฉํ๊ธฐ ๋๋ฌธ์ .์ด ์๋ต๋์์ต๋๋ค. */
.App header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
/* .App ์์ ๋ค์ด ์๋ a ํ๊ทธ */
.App a {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
// ๊ทธ์ ๋ง์ถฐ ์ปดํฌ๋ํธ์ JSX ๋ถ๋ถ๋ ์์ !
// App.jsx
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<header>
<img src={logo} className="logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
}
export default App;
์ด๋ฐ ์์ผ๋ก ์ปดํฌ๋ํธ์ ์ต์์ html ์์์๋ ์ปดํฌ๋ํธ์ ์ด๋ฆ์ผ๋ก ํด๋์ค ์ด๋ฆ์ ์ง๊ณ (.App), ๊ทธ ๋ด๋ถ์์๋ ์๋ฌธ์๋ฅผ ์ ๋ ฅํ๊ฑฐ๋(.logo), header ๊ฐ์ ํ๊ทธ๋ฅผ ์ฌ์ฉํด ํด๋์ค ์ด๋ฆ์ด ๋ถํ์ํ ๊ฒฝ์ฐ์๋ ์์ ์๋ตํ ์๋ ์๋ค.