HTML is an acronym for HyperText Markup Language. It is the language translated by web browsers to produce the web pages you see.
Web browsers read HTML tags and respond to the enclosed commands. To make a tag, you place a command between < and > characters. Most commands have a "start" tag and an "end" tag. "End" tags begin with </. If a command has no "end" tag, it is coded like so: <br> (traditional syntax) or <br /> (XHTML compatible syntax).
You used eight tags to produce your first web page. Let's look closely at each one.
<head> and </head> give the browser information used to generate the web page, but not information to be shown on the web page.
<title> and </title> tell the browser the title of the page. This will appear in the title block at the top of the web page when it is displayed. It is also used by search engines and browsers to identify the page to the viewer. The title for this page is "Lesson 2B - HTML Tags". Note these tags appear between the <head> and </head> tags.
<body> and </body> give the browser information to be shown in the body of the web page.
These eight tags are mandatory for all HTML web pages, regardless of page content. Which ones are start tags, and which are end tags?
Suppose you want to write notes to yourself within the file, but you don't want them to appear on the web page? Similar to most programming languages, HTML provides for comments. The Comment tag has no end tag, whatever comment you want to write is inserted within the Comment tag itself:
Anything within the Comment tag will not be displayed. Try it.
Today's browsers are powerful, and are programmed to handle mistakes in the HTML code. You can make mistakes with tags, and those tags will be ignored. If new tags are invented and old browsers don't recognize them, they will simply be ignored also. This way, something will be displayed rather than have an error message appear when one tag is not understood. Most browsers will insert whichever of these eight mandatory tags are missing! This protects the programmer, but does nothing to encourage proper coding.
- In this lesson, we learned about these tags:
- <html> and </html>
- <head> and </head>
- <title> and </title>
- <body> and </body>
- <!-- -->