Home > Web Front-end > CSS Tutorial > How to Create a Fixed Header and Footer with Scrollable Content?

How to Create a Fixed Header and Footer with Scrollable Content?

Linda Hamilton
Release: 2024-12-04 03:12:10
Original
400 people have browsed it

How to Create a Fixed Header and Footer with Scrollable Content?

Fixed Header and Footer with Scrollable Content: A Minimal Solution

Achieving a fixed header and footer with scrollable content mimics the layout seen on websites like the one in the referenced image. Here's a minimal CSS and HTML code snippet that can achieve this effect:

HTML:

<html>
  <body>
Copy after login

CSS:

  • #header sets the header to be fixed at the top of the page, with a defined height and width. overflow:hidden prevents the content from overflowing the header.
  • #content defines the scrollable content area, positioned below the header and extending to the bottom of the page.
  • #footer is fixed at the bottom of the page, with a similar height and overflow property as the header.

The above is the detailed content of How to Create a Fixed Header and Footer with Scrollable Content?. 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