Understanding the Difference: Divs vs. HTML Tags like Header, Footer, Section, and More

Jaume Puig
3 min readMay 22, 2023

Introduction

When it comes to structuring the content of a web page, HTML provides us with a variety of tags to choose from. While the humble <div> has been a staple of web design for many years, HTML5 introduced new semantic tags such as <header>, <footer>, and <section>. Understanding the differences between using a bunch of <div> elements and utilizing these semantic tags is essential for creating well-structured, accessible, and search engine-friendly web pages. In this article, we will explore the disparities between <div> elements and semantic tags, and why using the latter can significantly enhance the quality and maintainability of your code.

The Purpose of <div>: A Generic Container

The <div> tag is a generic container that has no semantic meaning on its own. It is often used to group and style elements, applying CSS classes or IDs to target specific elements. While <div> provides flexibility, it lacks clarity in terms of the content it contains. It doesn't provide any information about the purpose or role of the content within it.

Semantic Tags: Adding Meaning and Structure

--

--