Backup Copy of A694875 - Getting Started

0 Conversations

HTML is written in “elements”, these are commonly referred to as "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 then one that tels the browser which version of HTML we are using. The "DOCTYPE" begins the HTML document. According to web-standards, each HTML document should have a document type declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

This declares the document to be XHTML 1.0

The next tag we'll need then, is the one that tells the browser where the HTML starts:


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


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:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Welcome to my web page
Check here for more stuff coming soon.

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, you will also see the "meta" tag which in this case sets the character set1 to be used is closed by the "/" at the end of the tag (it might help to think of a "character set" as an alphabet). 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:

&lt; for a "<"


&gt; 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 here.

Back to the project Index.

1The character set used should be appropriate to the language you are using in your web-page

Bookmark on your Personal Space

Conversations About This Entry

There are no Conversations for this Entry



Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry

Written by


h2g2 Entries

External Links

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


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