Why does my footer float up into the middle of the page when content is short
Attempt number 5 at this and I am still stuck, so I am asking. My portfolio has a header, a main section and a footer. On the pages with a lot of text it is fine. On my Contact page there are only three lines of text, and the footer sits right under them, in the middle of the screen, with a big white gap below it. I want the footer at the bottom of the window.
Cite
CoursesWeb Forum, "Why does my footer float up into the middle of the page when content is short", https://coursesweb.net/forum/t/why-does-my-footer-float-up-into-the-middle-of-the-page-when-content/, accessed 2026-12-01.<body> <header>My portfolio</header> <main> <h1>Contact</h1> <p>Email me at the address below.</p> </main> <footer>Ferdi K. 2026</footer> </body>footer { background: #222; color: #fff; padding: 20px; }What I tried so far:
- height: 100% on body (nothing changed)
- position: absolute; bottom: 0 on the footer (it is at the bottom now, but on my long pages it covers the last paragraph)
- margin-top: 400px on the footer (works on my laptop, broke on my phone)
I used to run a warehouse shift, so I like things being where they belong. Why does the footer not just go to the bottom by itself?
Write something first.
Give people something to work with: at least 30 words on what happened and what you tried.
That is too long. Keep it under 6,000 characters.
Write the question as the title, 15 to 140 characters, no links.
Pick a category.
Add a name (2 to 40 characters, no links).
That email address does not look right.
That was quick. Read the thread, then try again.
The form expired. Reload the page and post again.
Something went wrong with the form. Reload and try again.
Please complete the check and post again.
Limit reached for now. Try again later.
This thread is closed to new replies.
This thread no longer accepts replies.
Something went wrong with the form. Reload and try again.
Post a reply or question first (name and email), then this browser can vote, edit and accept answers.
You cannot vote on your own post.
Only the author (within 30 days) or the forum team can do that.
That email already has an account. Use your sign-in link instead.
New accounts are paused for the moment. Try again later.
That was already posted.