Learn HTML Header and Footer Example with Code Snippets

Headers and footers in HTML are crucial elements that help structure and organize web content. They serve distinct purposes: headers usually contain the main title, navigation menus, and other global elements for your website, while footers typically hold copyright information, secondary menus, or site-wide links. Let's dive into practical examples of both.

15+ Modern Landing Page Footer design examples | LandingGo
15+ Modern Landing Page Footer design examples | LandingGo

We'll use HTML5 for our examples, which introduces new semantic elements to better convey the meaning of content through markup.

Fixed Header with html and css
Fixed Header with html and css

Headers in HTML

The <header> element represents introductory content or a set of navigational links about the current section of the document. It usually contains the title, logo, or large network links.

an image of a website page with different font and numbers
an image of a website page with different font and numbers

Let's create a simple header with a logo and a navigation menu:

3-8: Introducing HTML5 footer, header, nav, article, section and aside elements – Bioinformatics Web Development
3-8: Introducing HTML5 footer, header, nav, article, section and aside elements – Bioinformatics Web Development

Using Headers for Articles

Headers are not limited to the top of the page. They can also be used within individual sections, such as in blog posts or articles. In this case, the<header> element can contain a title and a byline:

Article Title

10+ Modern Landing Page Header Design Inspiration | LandingGo
10+ Modern Landing Page Header Design Inspiration | LandingGo

Multi-level Headers

You can also create multi-level headers using <header> elements within other <header> elements:

CSS Headers
CSS Headers

Site Title

This nesting approach is particularly useful for complex pages with several sections, helping to define a clear visual hierarchy.

the website page for footers is shown in blue and white
the website page for footers is shown in blue and white
10+ Landing Page Header Examples to Inspire Your Next Design
10+ Landing Page Header Examples to Inspire Your Next Design
three different types of webpages are shown in the same color scheme, one is blue
three different types of webpages are shown in the same color scheme, one is blue
the ultimate guide to creating an awesome website page
the ultimate guide to creating an awesome website page
How to Make a Footer in HTML and CSS for Beginners Tutorial - Fully Responsive
How to Make a Footer in HTML and CSS for Beginners Tutorial - Fully Responsive
Unlimited Header & Footer Options
Unlimited Header & Footer Options
20 Customizable Header Styles #dynamicliquids #uiux
20 Customizable Header Styles #dynamicliquids #uiux
Market - Multipurpose eCommerce HTML Template
Market - Multipurpose eCommerce HTML Template
Download 50+ Free Elementor Footer Templates | MC Starters Blog
Download 50+ Free Elementor Footer Templates | MC Starters Blog
Difference Between Header and Footer | Purpose, How to Set / Edit Header and Footer
Difference Between Header and Footer | Purpose, How to Set / Edit Header and Footer
Footer 4
Footer 4
website footer variations
website footer variations
Youtube Like Template Layout Design Using HTML5 and CSS
Youtube Like Template Layout Design Using HTML5 and CSS
Semantic HTML Infographic for SEO Page Structure
Semantic HTML Infographic for SEO Page Structure
an image of people standing on the top of a hill with mountains in the background
an image of people standing on the top of a hill with mountains in the background
HTML Basics: You Can Have Multiple <footer> Tags! 🦶
HTML Basics: You Can Have Multiple <footer> Tags! 🦶
Create Responsive Footer Design using HTML and CSS | Free Source Code
Create Responsive Footer Design using HTML and CSS | Free Source Code
Transforma tu plataforma web rápido
Transforma tu plataforma web rápido
#1 Footer - Colorful Flower Doodle
#1 Footer - Colorful Flower Doodle
15 Useful HTML5 Tutorials and Cheat Sheets
15 Useful HTML5 Tutorials and Cheat Sheets

Footers in HTML

The <footer> element defines the footer for a section or for the entire page. It usually contains contact information, copyright details, or links to terms of service and privacy policy documents.

Let's create a basic footer with essential information:

© 2022 Your Company Name. All rights reserved.

Footers in Multi-Page Contexts

In a multi-page website, you might want to keep certain elements consistent across all pages, such as a sticky footer containing a newsletter subscription form or social media links:

Footer design is a balancing act between providing useful information and keeping the page layout clean. Don't shy away from using white space or simple layouts to achieve this balance.

Experiment with different header and footer designs to create a unique and engaging user experience on your website. Consider user needs, accessibility, and search engine optimization when making design decisions. Happy coding!

Related Articles

Html Css Javascript Course W3schools W3schools Html Horizontal Rule W3schools Html Slider Control W3schools Com Html Colors Html Css Horizontal Line With Text Html And Css Buttons Div And Span Tag In Html W3schools Display Page Number In Html W3schools W3schools Html Head Tag Sample Html Code W3schools