Prepared by: Anthony Larrain


Before starting this tutorial read lecture notes 1

Getting Started

Webpages are basically text files with extra information together with the text to describe how the text should be interpreted by the browser. Many webpages are written using the Hyper Text Markup Language or HTML. HTML is a formatting language that consists of a collection of commands or tags that specifies the structure of the document(headings, paragraphs, lists) and how the text should be displayed (bold, color, size, etc..), what image to display and where the links will take you. You can think of a webpage as a collection of words and sentences mixed with HTML that specifies which sentences are paragraphs or headings, which words should be displayed in bold or displayed in italics etc..

In order for the browser to distinguish between the words we want our webpage to display and the HTML commands, all HTML commands are placed between angle brackets < > . For example, the command to make a word or a group of words bold face is named strong.

Example 1

To make the word Welcome bold in the sentence.. Welcome to Hci201 you would write in the text file

<strong>Welcome</strong> to Hci201

Browser Display

Welcome to Hci201

To make the whole sentence bold you would write in the text file

<strong>Welcome to Hci201</strong>

Browser Display

Welcome to Hci201

The above HTML code explained

All start tags should have a corresponding end tag.

Example 2

In this example we will write the HTML code to produce this webpage, ex2.html

Looking at this webpage we see it is composed of two elements a heading and a paragraph. The HTML commands for a heading and a paragraph are:

To write an HTML file use any text editor Notepad or Textpad (for windows) or SimpleText (for the Mac). For this example I will use textpad which is installed in all of the Depaul labs.

When you start Textpad you should see this.

If the right panel is grey, up at the menu select File --> New

If you are using textpad the first thing you want to do is save the file as something .html for this example we will save it first as ex2.html. Just don't save the file anywhere, know where you are saving it to. I would first create a folder on your C: drive called htmlcode and save the file there.

Notice that I moved to the directory htmlcode and the file name is ex2.html

Next type the following HTML code into the right panel of textpad. I would type it. Re-typing code is a good way to learn the code.

Make sure when you are done typing in the code you save the file.

Next you want to display the webpage in your browser. Remember webpages are stored on webservers so anyone connected to the internet can view your pages. You can write and test your webpages without your files being stored on a server.

To view your page locally or offline, start your browser. I will use IE. Once the broswer is started select file --> open.

Navigate to the folder(directory) where you saved the file select it, then press okay.

If all goes well, this is what you should see.


Example 2 Explained


A Template

The bare minimun of HTML code your documents should contain is

<html> <head> <title>Your Title Goes Here</title> </head> <body> Place in here the HTML code and Text that determines your page. </body> </html>

More on HTML tags

@Anthony Larrain 2005 - 2007

Send Questions or Comments to hci201@yahoo.com