(t:HTML Basics:t)

In this tutorial we'll cover some of the basics of HTML.

HTML is an acronym for Hyper-Text-Markup-Language. It's a language developed in 1990 for sharing documents over the internet. For an in-depth look at it's history and development you can check out the Wikipedia entry for HTML.

You'll need a good text editor for editing HTML code, something like NOTEPAD should work fine for now:


Open your text editor and enter this code below:
  1. <html>
  2. <head>
  3. <title>My first web page</title>
  4. </head>
  5. <body>
  6. Hello World!
  7. </body>
  8. </html>
<html> <head> <title>My first web page</title> </head> <body> Hello World! </body> </html>

You can type the previous example in your text editor. Then save it as "test.html".

Most web browsers (i.e. Firefox and Internet Explorer) have a function under the "File" menu entry to open files. For example, in Firefox:


From here you should be able to select the file you just created in your text editor and open it. Once open you should see the following in your browser:

Hello World!


Let's go over this little bit of code:

As you can see, much of this document contains "tags" inside brackets:
<html>, <body> and their closing counterparts </body> and </html>.


Now that you understand the concept of "tags" we can get a little more creative by implementing another set of tags and using tag "properties" to modify how text is rendered on the web page.

Try this bit of code in your text editor:
  1. <html>
  2. <head>
  3. <title>My first web page</title>
  4. </head>
  5. <body>
  6. <font color="blue">
  7. Hello grandma.
  8. </font>
  9. <br>
  10. <font color="#ff0000">
  11. <b>
  12. My, what big eyes you have!
  13. </b>
  14. </font>
  15. </body>
  16. </html>
<html> <head> <title>My first web page</title> </head> <body> <font color="blue"> Hello grandma. </font> <br> <font color="#ff000"> <b> My, what big eyes you have! </b> </font> </body> </html>

Save it to "test.html" and open it in your browser.

Incidently you should know that you don't have to "open" the file everytime in your browser. Most browsers have a "Refresh" or "Reload" function as a toolbar button or menu item. You can use this to reload the file after making changes. Some browsers may require you hold the "shift" key down while refreshing the page lest they load a "cached" version of the page and you never see the changes you made.

If all goes well, you should see something like the following:

Hello grandma.
My, what big eyes you have!


Let's go over what was done here, line-by-line...
Now add the tags in lines #6 and #16 to modify the above code like so:
  1. <html>
  2. <head>
  3. <title>My first web page</title>
  4. </head>
  5. <body>
  6. <center>
  7. <font color="blue">
  8. Hello grandma.
  9. </font>
  10. <br>
  11. <font color="#ff0000">
  12. <b>
  13. My, what big eyes you have!
  14. </b>
  15. </font>
  16. </center>
  17. </body>
  18. </html>
<html> <head> <title>My first web page</title> </head> <body> <center> <font color="blue"> Hello grandma. </font> <br> <font color="#ff000"> <b> My, what big eyes you have! </b> </font> </center> </body> </html>

Save the file and refresh it in your browser. You should see something like the following:

Hello grandma.
My, what big eyes you have!


We've encapsulated the font tags and text elements with the "<center>" and "</center>" tags so all the elements within these tags are centered on the page.

Now there's one more popular element we should cover. The "<img>" tag. This allows you to add images to your documents.

Add the tags in lines #16 and #17 to modify the code like so:
  1. <html>
  2. <head>
  3. <title>My first web page</title>
  4. </head>
  5. <body>
  6. <center>
  7. <font color="blue">
  8. Hello grandma.
  9. </font>
  10. <br>
  11. <font color="#ff0000">
  12. <b>
  13. My, what big eyes you have!
  14. </b>
  15. </font>
  16. <br>
  17. <img src="http://www.gurulounge.net/images/wolf.jpg">
  18. </center>
  19. </body>
  20. </html>
<html> <head> <title>My first web page</title> </head> <body> <center> <font color="blue"> Hello grandma. </font> <br> <font color="#ff000"> <b> My, what big eyes you have! </b> </font> <br> <img src="http://www.gurulounge.net/images/wolf.jpg"> </center> </body> </html>

Save the file and refresh it in your browser. You should see the following:

Hello grandma.
My, what big eyes you have!



This covers some basic concepts of HTML. There a quite a large number of tags and properties you can use to add and modify content. A complete list of tags and their properties is beyond the scope of this tutorial. You can find a more comprehensive reference on the W3C website or by searching the internet for references.