I Do Declare
Open a text editor of your choice and begin your HTML code with this bit of code:
That's what's called a "declaration". It doesn't do anything to your webpage but the folks who set the rules for HTML want it at the start of every HTML file.
Opening and Closing Tags
HTML code is referred to as tags. Most tags have both an opening tag and a corresponding closing tag. After the declaration every HTML file begins with this opening tag:
Every HTML file ends with the corresponding closing tag:
Notice the / in the closing tag? All closing tags must have this slash. You know why? Because it's a closing tag, that's why.
Below the opening html tag come the opening and closing head tags:
The head tag doesn't affect what appears on the web page, it's job is to hold certain other types of tags, one being the title tag:
<html>
<head>
<title>My First Webpage</title>
</head>
The text between the title tags will
appear in the browser's title bar:
Everything that is seen on a web page is found between the opening and closing body tags:
Example:
<html>
<head><title>My First Webpage</title>
</head>
<body>
Look Ma, I'm Making my first webpage
</body>
</html>
Notice that the closing html tag was added to the code. This means we are finished (at least for now), so save your code by giving the file a name and adding the .html like so: index.html
Important note:
The file name of your HTML code can be anything you want but you must name the homepage index.html or else your site's web address will not work.
Curious to see how the webpage looks? Click on the file to open it in your browser. To edit the code, open the file from your text editor, be sure that "All Files" is selected from the editor's dialog box.
The next lesson will introduce you to more tags and what they do. So let's move on to lesson 2