What are Header and Footer?
The <header> and <footer> elements are semantic HTML tags used to define the top and bottom sections of a webpage or a section.
Header Element
The <header> typically contains branding, logos, navigation links, or introductory content.
Footer Element
The <footer> typically contains copyright information, contact details, and additional links.
Complete Example
Multiple Header & Footer Usage
You can use multiple header and footer elements within sections or articles.
Styling with CSS
Best Practices
- Use header for branding and navigation
- Use footer for copyright and links
- Keep header clean and simple
- Avoid overloading footer with too much content
- Use semantic structure for better SEO and accessibility
Common Mistakes
- Using div instead of semantic tags
- Overcrowding header with too many elements
- Ignoring accessibility considerations
- Placing unrelated content in footer
Conclusion
HTML header and footer elements are essential for structuring web pages. Proper use improves readability, SEO, and accessibility.