Hey, I love to write articles so here is my unnecessarily long and probably boring take about this question:
HTML is a markup language, we use it to define meaning and general structure for a website.
Inside the <html>
tag which tells the browser “hey I am an html document and between <html>
and </html>
is my documents body”. Oh by the way, the thing above " <!DOCTYPE html>
" indicates I am not any HTML like HTML4 but HTML5 so please treat me as such.
All is fine and dandy, finally a browser is able to identify our HTML5 document but there is too much information in a document and further more… information about information(yeah… I know how you feel, take 1 minute to let that sink in) we call that information metadata and as you’ll probably realize in the future(more like 1/2 paragraph into the future) it is a must have.
So roughly speaking HTML’s take about how to organize this information and metadata is to divide it as follows:
<head>
Here you should put the information and metadata for things like browsers, search engines, external documents like CSS style sheets and javascript scripts. A lot of code can go into this secton but it follows the patterns I just described. Mr.Google and its spider bots (Maybe a future article ) will come into your website and a good <head>
is one of the things that will let it know it is a top notch high quality ultimate source of <insert idea>
and should be placed in the top results of a related search.
<body>
I’ve written quite a lot and I could go on and on about what goes into this section but I don’t want to over do it. I will just say that here you’ll put all those juicy paragraphs, headings, forms and everything that the user will see in the main screen of its browser, the actual content.
SOOOOO the TL;DR and answer to your question is the <title>
tag will only modify the title of your broswer’s tab but there can be a lot of more information inside your head element as the example code I give you below so <title>
is its own tag. <h1>
is the title for the body of your document and there should be only 1.
General Structure of an HTML Document:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="You wouldn't believe it even if I told you">
<meta name="keywords" content="HTML,CSS,JavaScript ">
<meta name="author" content="coolCat">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> The best page ever</title>
</head>
<body>
<h1>The best page ever</h1>
</body>
</html>