Why we gotta use <header> before heading? We can simply write <h1> or any other heading. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we gotta use <header> before heading? We can simply write <h1> or any other heading.

Also, which of these is tag and which is element?

26th Apr 2020, 1:41 PM
TAVISH
TAVISH - avatar
5 Answers
0
tavilefty you are correct, you can achieve with <h1> tag for heading text/data/information for the page the same as <header>. <header> is much more, think of logical container where you can mix <nav>, <ul>, logo and other tags for content representation. For example, similar approach is practised in PHP programming for including static/constant content of the web page like include header.php , footer.php or other pages.
5th May 2020, 1:55 PM
Ilyas Bakirov
Ilyas Bakirov - avatar
+ 2
You're not mandatory to use them... Usualy <h1> is wrapped in a <header> when the header will contains other elements than just a <h1> There are both tag AND element: we just name differently depending on context: 1) source code => tag 2) document object model (DOM) => element
26th Apr 2020, 3:05 PM
visph
visph - avatar
+ 1
You can write h1 for heading but when you would make a full website there you will need header, nav, section and footer tags.
26th Apr 2020, 1:55 PM
Samira
Samira - avatar
+ 1
You can use <div> tag instead of them but in html5 using those tags will be easier while coding.
26th Apr 2020, 2:13 PM
Samira
Samira - avatar
0
Samira but what if I don't use them?
26th Apr 2020, 2:08 PM
TAVISH
TAVISH - avatar