Welcome to the first part of this Beginning HTML article. In this part,
you will learn how to create a simple web page using HTML. To begin, open up
a simple text editor (for example Notepad on Windows or SimpleText on Mac).
Using something like Microsoft Word can work, however note that when you
save the document, you must specify that you would like to save it as a "textfile"
so Word does not save extra formatting information.
Now, in the file type the following:
<html>
<head>
<title>Title of page</title>
</head>
<body>
This is my first homepage. <b>This text is bold</b>
</body>
</html> |
Save the file as "test.htm" or "test.html" (Browsers will read both of
the extensions as html files, so you may choose one. It is a good idea to
choose one and be consistent with how you name your html files in the
future. This makes things cleaner and simpler)
Now open up a web browser and go to location where the file is stored,
for example "C:\MyDocuments\test.html" (or "test.htm").
Explanation:
Notice you see much less than the file actually contains. The rest of the
information in the test.html file are HTML tags. These tags tell the browser
how to display the page.
Line by line:
The <html> tag simply tells the
browser that the following document (test.html) will contain HTML code
The <head> tag specifies that
following information contains "header" information, or information about
the html page.
The <title> tag tells the browser
what to display at the very top of the browser window.
Note the <head> tag is then closed
using </head>
Now, we come to the <body> tag,
which tells the browser that information about actualy page content, i.e.
the body, will follow.
- Now, you can type text; anything not recognized by the browser will be
sent to the screen.
The <b> tag tells the browser to
make everything Bold following the <b>
tag until the </b> tag is reached.
As with above, we close our body tag using
</body> and finally the html tag using
</html>