228k views
4 votes
How to create footer to stay at the bottom of a Web page?

User Jvous
by
6.0k points

1 Answer

6 votes

Final answer:

To create a footer that stays at the bottom of a web page, you can use CSS positioning with the 'fixed' property.

Step-by-step explanation:

To create a footer that stays at the bottom of a web page, you can use CSS positioning. One common way to do this is to use the 'fixed' position property on the footer element. Here's an example:

<style>
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: #f5f5f5;
text-align: center;
padding: 10px;
}
</style>
<footer>
This is the footer content.
</footer>

In this example, the 'position: fixed;' property ensures that the footer will always stay at the bottom of the page, regardless of scrolling. The 'bottom: 0;' property sets the footer's distance from the bottom edge of the viewport. Feel free to customize the CSS properties to fit your design.

User Hashan Seneviratne
by
7.2k points