Back to HTML Notes
Topic #189

The footer Element

Learn how to use the HTML <footer> element to define closing content for a page or section, and understand its role in accessibility.

What it is

The <footer> element represents a footer for its nearest ancestor <article>, <aside>, <main>, <nav>, <section>, or <body> element. It typically contains information about the author, copyright data, links to related documents, or navigation aids.

Mental Model: Think of the footer as the "signature" or "closing remarks" of a specific block of content. Just as a book has a back cover with publisher info, a web section can have a footer with relevant metadata.

Related terms: <header>, <address>, Landmark Roles.

Why it matters

  • Semantic Structure: Helps browsers and search engines understand the layout and hierarchy of your document.
  • Accessibility: Screen readers identify footers as landmarks, allowing users to jump directly to this region using keyboard shortcuts.
  • Reusability: You can nest multiple footers within different sections (e.g., one for the whole page, one for each blog post).
  • Styling Hooks: Provides a clear CSS selector target for consistent styling of bottom-of-section content.

Syntax or steps

The basic syntax is simple. Place the opening tag before the content and the closing tag after.

<footer>
  <p>Content goes here</p>
</footer>

You can place a <footer> inside the <body> for a site-wide footer, or inside an <article> or <section> for a component-specific footer.

Example

Here is a realistic example showing both a page-level footer and an article-level footer.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Footer Example</title>
</head>
<body>
    <article>
        <h1>Understanding HTML5</h1>
        <p>HTML5 introduced semantic elements like header and footer.</p>
        
        <!-- Article-specific footer -->
        <footer>
            <p>Written by Jane Doe on Jan 1, 2024</p>
            <a href="/contact">Contact Author</a>
        </footer>
    </article>

    <!-- Page-level footer -->
    <footer>
        <p>&copy; 2024 My Website. All rights reserved.</p>
        <nav>
            <a href="/privacy">Privacy Policy</a>
            <a href="/terms">Terms of Service</a>
        </nav>
    </footer>
</body>
</html>

Explanation: The first <footer> belongs to the <article>. It provides metadata specific to that post (author, date). The second <footer> is a direct child of <body>, serving as the global site footer with copyright and legal links.

Common mistakes

  • Using it only for visual styling: Do not use <footer> just because you want gray text at the bottom. Use it when the content is semantically a footer (metadata, links, copyright).
  • Nesting incorrectly: A <footer> cannot be a descendant of another <footer>, <header>, or <address> element.
  • Forgetting the address element: If the footer contains contact information for the author or organization, wrap it in an <address> tag inside the footer for better semantics.
  • Assuming it's always at the bottom: While visually often placed at the bottom, the semantic meaning is "closing content," which might appear elsewhere depending on layout logic (though rare).

When to use it

Compare <footer> with generic <div> containers.

Feature<footer><div>
Semantic MeaningHigh (Landmark)None (Generic)
AccessibilityScreen reader navigableInvisible to AT structure
Use CaseClosing metadata/linksLayout grouping only

Use <footer> whenever the content serves as a conclusion or reference point for the preceding section. Use <div> only if there is no semantic relationship to the surrounding content.

Practice

Guided Exercise: Create a simple HTML page with a <section> containing a heading and paragraph. Add a <footer> inside that section listing two fictional sources.

Challenge: Modify the previous exercise to include a page-level footer outside the section. Ensure the screen reader order makes sense (Section Footer then Page Footer).

Hint: Check your code in a browser's accessibility inspector to see if the "contentinfo" landmark appears correctly.

Quick check

Question: Can a <footer> element contain interactive elements like buttons or forms?

Answer: Yes. The <footer> element can contain any flow content, including forms, buttons, and links, provided they are relevant to the closing context of the section.

Summary

The <footer> element is a semantic tool for defining closing content associated with a specific section or the entire page. By using it correctly, you improve accessibility for screen reader users and create a more structured, maintainable document.

Want to go beyond the notes?

Join Coding Now Tech Institute's HTML course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

The footer Element – FAQs

Quick answers about learning The footer Element in HTML.

This free note from Coding Now Tech Institute explains The footer Element in HTML — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every HTML topic on Coding Now Tech Institute, including The footer Element, is 100% free with no signup required.
With focused practice, most students grasp The footer Element in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now