How to Put a Footer at the Bottom of the Page Using CSS

Learn how to place a footer at the bottom of your webpage using CSS with fixed and flexible layout methods.

300 views

To place a footer at the bottom of the page, use CSS. Ensure you have a `footer` tag in your HTML, then apply styles to it. Use `position: absolute;` and `bottom: 0;` for fixed footers, or `position: relative;` and `min-height: 100vh;` on the `body` and a `margin-top: auto;` on the `footer` for flexible layouts. This will hold the footer at the bottom regardless of content.

FAQs & Answers

  1. What CSS properties keep a footer at the bottom of the page? You can use 'position: absolute; bottom: 0;' for a fixed footer or 'min-height: 100vh;' on the body with 'margin-top: auto;' on the footer for flexible layouts.
  2. How do I create a sticky footer in CSS? A sticky footer can be created by applying 'display: flex; flex-direction: column; min-height: 100vh;' on the body, and setting 'margin-top: auto;' on the footer.
  3. Can I use the HTML <footer> tag for placing footers? Yes, the <footer> HTML tag is semantically appropriate to contain footer content and works well with CSS styles to position footers.