Categories
Tags
a Accessibility Advanced Algorithms Alias Bash bash Basics Beginners Best Practices Big O bun cat cd CLI Comments Container Elements Container Queries cp css CSS Data Structures deno Doctype Download Editors Error Examples Features figure File Watching Filesystem fish Fish Shell footer frontend Guide header Hello World History Homebrew HTML HTML5 humor img javascript JavaScript Learning less Links linux Linux ls macOS Media Queries meta Mobile-First mv Netcat Networking Node.js npm Package Manager picture pm2 Productivity programming Programming pwd Responsive Design Responsive Images rmdir Scalability section Semantic HTML shell Shell Shell Script Shells srcset State Management Structure Svelte Svelte Store SvelteKit svg Tables tail Text Formatting Tools touch Troubleshooting Tutorial Unix ux Vim web development Web Development web-development webdev
188 words
1 minutes
How to Use the `header` and `footer` Tags
How to Use the header
and footer
Tags
The <header>
and <footer>
tags in HTML are used to define the header and footer sections of a web page or a section. This guide explains how to use these tags effectively.
Basic Syntax
<header>
The <header>
tag is used to define the header section:
<header>
<h1>Website Title</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
</ul>
</nav>
</header>
<footer>
The <footer>
tag is used to define the footer section:
<footer>
<p>© 2023 Your Website</p>
</footer>
Use Cases
Page Header and Footer
The <header>
and <footer>
tags are commonly used to define the header and footer sections of a web page:
<header>
<h1>Website Title</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
</ul>
</nav>
</header>
<main>
<h2>Main Content</h2>
<p>This is the main content of the page.</p>
</main>
<footer>
<p>© 2023 Your Website</p>
</footer>
Section Header and Footer
The <header>
and <footer>
tags can also be used within sections to define their headers and footers:
<section>
<header>
<h2>Section Title</h2>
</header>
<p>Section content...</p>
<footer>
<p>Section footer content...</p>
</footer>
</section>
Conclusion
The <header>
and <footer>
tags are essential for defining the header and footer sections of a web page or a section. By using these tags, you can create well-structured and easily navigable content.
How to Use the `header` and `footer` Tags
https://zxce3.net/posts/how-to-use-the-header-and-footer-tags/