HTML Quick Introduction
HTML is a language used to specify the layout of documents as well as the links between them.
An HTML document consists of tags, which are identified by angle brackets, and text. Most tags come in pairs, with the closing tag indicated by a forward slash character. Every HTML document should have <html>, <head>, and <body> tags.
To get a sense of HTML, let's build the simple page shown here.
HTML <Head> Section
The <head> section contains information about the document, including the title that will appear in the title bar of the browser window. It is specified within a <title> tag.
<html>
<head><title>Learning HTML</title></head>
<body>
</body> </html>
Our Document's Text
The <body> contains the actual contents of the page. Anything within the <body> that is not a tag is text that will be displayed by the browser. The <b> tag is used to make some of our text bold.
Note that HTML is not a line-oriented language. Although we have placed our text on two lines, when the page is displayed the browser may show it all on one line, if the window is wide enough, or wrap it onto multiple lines.
<html>
<head><title>Learning HTML</title></head>
<body>
For a good book about HTML,
we recommend <b>HTML & XHTML: The Definitive Guide</b>.
</body> </html>
Linking Documents
To provide a link to another page, we surround the link text with an anchor, or <a>, tag. Its href attribute gives the address (or URL) of the page to display when the user clicks on this text.
<html>
<head><title>Learning HTML</title></head>
<body>
For a good book about HTML,
we recommend <b>HTML & XHTML: The Definitive Guide</b>.
Check it out on the
<a href="https://www.oreilly.com">O'Reilly & Associates Web site</a>.
</body> </html>
Using Images
To add an image to our page, we use an <img> tag with two attributes: src, which specifies the image to display, and align, which places it to the left of our text.
Note that <img> is an example of a tag that is not paired. There is no </img> tag.
<html>
<head><title>Learning HTML</title></head>
<body>
<img src="BookCover.gif"
align="left">
For a good book about HTML,
we recommend <b>HTML & XHTML: The Definitive Guide</b>.
Check it out on the
<a href="www.oreilly.com">O'Reilly & Associates Web site</a>.
</body> </html>
That's all the HTML we have time for here. To learn more, we really do recommend HTML & XHTML: The Definitive Guide published by O'Reilly & AssociatesOpens in a new tab.