Home Footer ํ•˜๋‹จ๊ณ ์ •
Post
Cancel

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๋„ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋‚˜์˜ด

This post is licensed under CC BY 4.0 by the author.

CSS grid

redux-thunk