HELLO WORLD: YOUR FIRST WEBPAGE USING HTML

 

Hello World you ask? The first lesson for every programming language is Hello World. Yes, HTML is a programming language - well technically it's a Markup Language but let's not get technical.

 

 

1. Open up a text editor, PC, Mac, Linux, whatever.

 

 

2. On the first line type:

 

<html>

 

Those funny brackets around the html will later tell the browser that everything below this will be HTML. This is known as the html tag. A tag is a markup (hence the name) that tells the browser to do something. Most tags have an opening tag and a closing tag. Closing tags are coming right up.

 

 

3. On the next line add:

 

<html>

<head>

 

HTML documents are made up like a person - except with no arms and no legs...so just a body and a head. The head tag is where all the smart stuff goes, all the behind the scenes code that helps the body do its job. The head tag is also where you define the title of your page.

 

 

4. So add on the next line:

 

<html>

<head>

<title>Hello World!</title>

 

Yep that's a lot more code than the last 2 steps. So you guessed it, the title tag let's you change the title of page in the browser. You can add whatever text you like. Play around a bit and see if you can break it. (if you're clever you'll notice that it ignores any more than one space at a time. You'll need to put in a special html code. Hint: &nbsp). The tag on the end is a closing tag and you can tell that by the forward slash at the front of it.

 

 

5. Next:

 

<html>

<head>

<title>Hello World!</title>

</head>

 

Yep, close off that head tag.

 

 

6. Add:

 

<html>

<head>

<title>Hello World!</title>

</head>

 

<body>Hello World!</body>

 

The body tag is where the guts of your site goes. Everything in here goes in the big white box in your browser.

 

 

7. Finish it off:

 

<html>

<head>

<title>Hello World!</title>

</head>

 

<body>Hello World!</body>

</html>

 

Close off the html tag to finish the page. You don't have to close the tags, but then it wont be proper HTML and if you get into that habit, later on there could be problems.

 

Now save out your text file as 'helloworld.html'. Make sure your text editor isn't saving as 'txt' or some other format by default. Once you've done that, open it in a web browser and pump your fist in the air.

 

If you've seen the extension as 'htm' before and was wondering what the differnce is...there is none, just like jpeg and jpg. But at the same time, keep it consistent within your site, don't mix 'htm's with 'html's.