What Are Tags?
Tags are what HTML code is called, and there are lots of them. But before we get to them, open the empty HTML file you made in the introduction and write 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 top of every HTML file.
Opening and Closing Tags
Most tags have an opening tag and a corresponding closing tag. Below the declaration every HTML file starts with this opening tag:
Every HTML file ends with the corresponding closing tag:
Take note of 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 such as the title tag:
<!DOCTYPE html>
<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 webpages is found between the opening and closing body tags:
Example:
<!DOCTYPE html>
<html>
<head><title>My First Webpage</title>
</head>
<body>
Look Ma, I'm Making my first webpage
</body>
That includes other tags as well, such as the strong tag which makes bold text:
<body>
Look Ma, I'm <strong>Making</strong> my first webpage
</body>
Any text between the opening and closing strong tags will be bold.
Wanna see how your webpage looks? Go to where you saved the file and click on it so it opens in your browser. To edit the code, open the file from your text editor, if you don't see it 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