How to make an Hello World Web Page

A web page has two main parts to it: the header, which you don't normally see and the body which contains the content.

The Header

This tells the computer what the document is and how to read it. You can put your JavaScript in here and also calls to other things like CSS styling sheets to make your page look pretty.

In order to get our examples to work you will need a basic header such as this. This tells the computer that what follows is written in HTML and uses the standard characters etc.

<!DOCTYPE HTML>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
</head>

So open your text editor, copy the stuff above in and save it as something like "MyHelloWorld1.html" etc.
The program won't work just yet as it has a head but no body!

The Body

Now you need to give the web page some content.
Body just tells the machine that this is the body!
Then you start a paragraph, write something and then end it.
Then you tell the machine that the content and then the whole document have finished.

Add this code to the header and then save it.

<body >
<p>Hello World</p>
</body>
</html>

Running The Code

You can just double click on your file in its folder. Or drag and drop the file into an open window of your browser.
If the code doesn't work check that compatibility (tools menu in IE10+) is turned off.

Example.

last updated 3rd September 2014