0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

フッターを一番下に固定する方法

Posted at

コンテンツの内容が少なくフッターが画面の途中にきてしまいフッターの下にスペースが開いてしまった時の解決方法。

HTML

sample.html
<body>
  <div id="wrapper">
    <main>
 
      コンテンツの内容
 
    </main>
 
    <footer>
 
      フッターの内容
 
    </footer>
  </div>
</body>

CSS

sample.css
body,
#wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
 
footer {
  margin-top: auto;
}

これでフッターがつねに一番下に配置されるようになりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?