What is difference between <head> and <h1> etc? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between <head> and <h1> etc?

Please tell me the difference also if I write <head> without any title than what happen?

11th Feb 2017, 5:03 AM
Vihaan Sharma
Vihaan Sharma - avatar
5 Answers
+ 8
<head> is a header that contains data the browser needs to render the HTML correctly. Ex: CSS/JS imports, the tab/window title, which character set to use, etc. Nothing in it is meant to display on the page. <h1> through <h6> are various sizes of paragraph headings. If you don't use <title>, the tab/window will show the URL of the page.
11th Feb 2017, 5:30 AM
Tamra
Tamra - avatar
+ 5
<head> is the tag used to handle <meta> tags (keywords and descriptions for search engines for example) and the <title> tag (to name the tab of the browser). If you write the <head> without any <title>, it will still run but the name of the tag becomes the address of the file. <h1> to <h6> are text header sizes. <h1> is the largest and <h6> is the smallest. It's ideal NOT to use these for text sizes. Instead if you want to change text size use either <elem style="font-size:size"></elem> where elem is a known tag and size is the size of text you want (ie 20px), or use some CSS styling.
11th Feb 2017, 5:31 AM
James Burton
James Burton - avatar
+ 4
<head> is use to create <title> then <title> is use to name the page while <h1>, <h2>, <h3>, <h4>, <h5>, <h6> is use for the header and they have a fixed font size. hope that I answered your question
11th Feb 2017, 5:31 AM
Stern Ritter
Stern Ritter - avatar
+ 2
thnx for answers my doubt cleared
11th Feb 2017, 5:33 AM
Vihaan Sharma
Vihaan Sharma - avatar
+ 1
You might know also more about the new html5 <header> element, wich could be confused also ^^ <header> is an intermediate element between the most generic container <div>, and the specificity of <h1> to <h6> elements ( 'h' stand for 'head/er' too, as 'title', and number next stand for the rank level of it ). <header> is a semantical generic container for all about titles: can being many on same page, at different level... or not. As root page header, or as sub-element header. Able to contain complex html content ( more than <hx> expected to just have text content, even if technically you can put others html elements )
11th Feb 2017, 6:26 AM
visph
visph - avatar