What is the difference between the above tags. Also, when to use what?
Hi @web9020947765 - good question.
They’re some examples of what’s called semantic HTML elements .
In the “old days”, you’d divide your page up using a load of
<div> tags which might have looked like this:
That’s all well and good for layout and styling, but it doesn’t convey a great deal of meaning about what that block of markup is for.
With semantic HTML elements, we can provide more information for a human reader with the tag itself - so a header is marked up using
<header>, or a section of a page with
You’d use these semantic elements wherever they’re appropriate - so you’d likely only have one
<header> </header> pair in your page, because there’s only one header (with your nav bar etc in it). Likewise, you’d only have one
<footer> </footer> but you might have several
Thanks! I read through the hyperlinks you attached. Very easy to understand and got to learn that the semantic tags like , and are newly introduced in HTML5. Very interesting!
I’m glad you learned something new - though I don’t know which tags you were referring to as the forum has removed them. (You can wrap them in ` characters to make the forum render them, like so:
This stuff was new to me as well, having originally learned how to write HTML back in '99 and not really doing much with it again until a couple of years ago.