A Real HTML File
Write a complete web page, boilerplate and all.
1<!doctype html>
2<html>
3 <head>
4 <title>My First Site</title>
5 </head>
6 <body>
7 <h1>Welcome to my site!</h1>
8 </body>
9</html>
Every line, explained
<!doctype html>- <!doctype html> is the very first line of every real web page. It simply tells the browser "this is a modern HTML page"; it is a declaration, not a tag, so it never gets closed.
<html>- <html> is the root: every other tag on the page lives inside it. Intro to HTML skipped this wrapper; now you are writing pages the way the pros do.
<head>- <head> holds information ABOUT the page: its title, and links to other files. Nothing inside <head> is drawn on the page itself.
<title>My First Site</title>- <title> names the browser tab. Look at the tab bar of a real browser: every name you see there is one of these.
</head>- </head> closes the head. The visible part of the page comes next.
<body>- <body> holds everything you can actually see: all the tags you learned in Intro to HTML go in here.
<h1>Welcome to my site!</h1>- An old friend from Intro to HTML, now sitting in its proper place inside <body>. This is the promised boilerplate: from here on, you are writing complete, real web pages.
</body>- </body> closes the body.
</html>- </html> closes the root tag. Nothing comes after it.