Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
86
Help us understand the problem. What is going on with this article?
@nozomi716

footerを常に最下部に固定する方法(簡単)

More than 1 year has passed since last update.

コンテンツ量が多い時も少ない時も、footerを常に最下部に持ってきたい。
そんな所で結構つまづいてしまったので自分用にメモ。

html・cssの記述は以下

test.html
<body>
  <div id="wrapper">
    <main>

       <!--コンテンツの記述-->

    </main>

    <footer>

       <!--フッターの記述-->

    </footer>
  </div>
</body>
test.css
body,
#wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

footer {
  margin-top: auto;
}

jqueryを使うとか、他にもやり方は色々あると思いますが
このやり方だといじる所も少なく、コピペですぐ実装できるので初心者にもおすすめ。

86
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
nozomi716
コーディングが苦手です。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
86
Help us understand the problem. What is going on with this article?