๐ footer ํ๋จ๊ณ ์
โ๏ธ 1. fixed
1
2
position: fixed;
bottom: 0;
fixed ์ ๊ฒฝ์ฐ footer๊ฐ ๋ฐ๋ ์ปจํ ์ธ ๋ฅผ ๊ฐ๋ฆฌ๊ฒ ๋์ด fail
โ๏ธ 2. absolute
1
2
position: absolute;
bottom: 0;
์คํฌ๋กค์ด ์์ผ๋ฉด ์ ์์ ์ธ๊ฒ์ฒ๋ผ ๋ณด์ด๋ ์คํฌ๋กค์ด ์๊ธฐ๋ ์๊ฐ ์์น๊ฐ ๊ณ ์ ๋์ด footer๊ฐ ์ด์ํ๊ฒ ๋์จ๋ค.
โ๏ธ 3. flex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<Wrapper>
<Header />
<div className="contentWrapper">
<Component {...pageProps} />
</div>
<Footer />
</Wrapper>
</>
);
}
const Wrapper = styled.div`
display: flex;
flex-direction: column;
height: 100vh;
.contentWrapper {
flex: 1;
}
`;
๋ฐ๋์ flex: 1์ ์ฃผ์ด ๋ด์ฉ์ด ์์ด๋ ๊ฝ์ฐจ๊ฒ ๋ง๋ค๊ณ footer๋ ์์ฐ์ค๋ฝ๊ฒ ๋์ด