Home > Web Front-end > CSS Tutorial > How to Keep a Footer at the Bottom of the Page Even When Scrolling?

How to Keep a Footer at the Bottom of the Page Even When Scrolling?

Linda Hamilton
Release: 2024-12-15 14:41:14
Original
522 people have browsed it

How to Keep a Footer at the Bottom of the Page Even When Scrolling?

Position Div at Content Bottom with Overflowed Scrollbars

When page content extends beyond the viewport, developers often encounter the issue of footers appearing above the page's bottom boundary. To resolve this behavior, consider the implementation outlined in the provided image.

The CSS snippet initially utilized, featuring position: absolute and bottom: 30px, positions the div at the viewport's bottom. However, upon scrolling, the div remains stationary, detaching itself from the content's bottom limit.

Solution

The optimal approach to anchoring the div persistently at the content's bottom necessitates the employment of fixed positioning. Here's the revised CSS:

This modification achieves the desired effect. The div remains fixed at the bottom of all content, regardless of scrolling. The provided fiddle demonstrates this behavior: http://jsfiddle.net/uw8f9/.

The above is the detailed content of How to Keep a Footer at the Bottom of the Page Even When Scrolling?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template