Creating a Web Page II : Learning HTML

0 Conversations

Previous entries in the "Creating a Web Page" series:

Since this is an HTML tutorial, this assumes that you are using either a text editor or are using the “edit source” feature of a WYSIWYG1 editor. This means that you will have to write the HTML yourself. Don't be scared- it won't "byte"2...

Getting Started

HTML is written in "tags". A "tag" is a command to the browser for how to display something. Tags usually (but not always) come in pairs: one that turns on the command, and one that turns it off. Whatever you want to display is in between the two. The very first tag we'll need then, is the one that tells the browser where the HTML starts:

<HTML>

then you've got all the other junk in your page, and at the very end:

</HTML>

tells the browser that it's reached the end of the HTML in that file.

An important concept in writing HTML is "nesting". Tags can fit inside each other; they have to since all other tags must be able to fit within the HTML tags. When you nest tags, you have to be sure that for every "on" there is an "off" (if an "off" is available), and that they are in the correct order:

<tag1><tag2><tag3>
yackety-yak </tag3></tag2></tag1>

You see how they have to be turned off in the opposite order that they were turned on? If the order gets mixed up, the browser gets confused and doesn't turn off a feature when it should so your entire page will end up in italics, for example. This will be come clearer in a second as we add in some more tags:

<HTML>
<HEAD>
<TITLE>Welcome to my web page!</TITLE>
</HEAD>
<BODY>

Check here for more stuff coming soon.
</BODY>
</HTML>

Notice how "TITLE" was closed before I closed "HEAD". "TITLE" in this case is what shows up at the top of the browser window, it does not show up on the page itself. That's why the "TITLE" tag is nested in the "HEAD" tag. Whatever is within the "BODY" tag is what will actually show up on the page.

Anything that is within the < and > will not be displayed on the page since the browser will assume it's HTML. So how did those signs appear in the example? You have to tell the browser specifically that you want the symbols and that they are not part of the HTML for the page. The HTML you would use to make those symbols appear is:

&#60; for a "<"


and

&#62; for a ">"

And yes, there was also a number code used to make the ampersand visible in the example. How do you find out what the number codes are for all the various symbols?

There are two ways you can find out the number codes, and this is a good opportunity to teach you a handy feature of your browser. Whenever you see something interesting in a page and wonder how they did it, in most cases you can look at the HTML for that page. Put your mouse over this page. PC users: right click on your mouse. A menu will appear. Click on "View page source". Mac users: go to the view menu, then select "View source". The little clump of junk before the HTML tag is the code you need to create a <. You can also get all the codes for symbols and punctuation from Visibone.

1"What You See Is What You Get" : acts more like a word processing program on the surface and writes the HTML for you in the background.2Sorry, couldn't resist the geek pun. To explain: a "byte" is a unit of information. Information is typically measured in thousands of bytes (kilobytes or K), millions of bytes (megabytes or "megs"), even billions of bytes (gigabytes or "gigs")3.3And half a byte is a "nibble". Seriously.

Bookmark on your Personal Space


Conversations About This Entry

There are no Conversations for this Entry

Entry

A668261

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

References

External Links

Not Panicking Ltd is not responsible for the content of external internet sites

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more