<div class="header"/> or <header> ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

<div class="header"/> or <header> ?

is there some cases where using <div class="header"/> or <div class="footer"/> would be more beneficial than using <header> or <footer>? After visiting many websites, and inspecting their elements, I noticed that they use many div with certain classes instead of <figure> <footer> .. other semantic elements.

21st Dec 2022, 6:42 AM
Ahmad Sulaiman
2 Answers
+ 3
Before HTML 5 we used divs to seperate sections in our pages. HTML 5 comes with semantic tags <audio>, <video>, <header>, <footer>, <canvas>, <article>, etc
21st Dec 2022, 7:14 AM
Chris Coder
Chris Coder - avatar
+ 3
Semantic tags are very important for the readability of the code, as well as for the browser's SEO score. Therefore, definitely, you need to use the semantic tag "header"
21st Dec 2022, 7:38 AM
Knight
Knight - avatar