sitemap

[ window | font | format | tables | links | lists | images | forms | layers ]


Bottom of page

HTML Tutorial


Written by Colin D. Joye 1/00

Html is one of the most useful, easy-to-learn languages you can use. It's good for making just about anything on your web pages: nicely styled reports, resumes, questionaires, tutorials,... you can even "embed" multiple, surfable webpages on one webpage! I have one friend who writes all his reports in Html, and prints them directly from his website! Html really does do that good a job at making things look nice.

The whole structure of Html is based on "tags". A tag is anything placed inside the "<" bracket and ">" bracket. Any command is put inside these brackets. Contrary to some misconception, the command in tags can be either upper or lower case, not just upper. I find it easier to type in lower case, so that's what I use. Almost every tag must be "turned on" (just using the tag) and "turned off" (using the same tag, but with a slash, "/", before the letters). For example, the widely used "anchor tag" (for making links) would be used: <a href="destination.html"> destination</a>. It would come out something like this: destination. The only tags that I know of which do not need to be "turned off" are <img>, <br>, <hr>,and <li>. <a name="NAME"> and <p> also do not require turning off, but it's recommended. Surely, there are others besides.

To create an Html file, type the template given in the "Basic Structure" window below into an editor (I always use Notepad), and save it as "*.html". You usually have to save the "home page" (the main page) as "index.html" or "index.htm" in order to use it as your main page. My main page has to be saved as "default.htm". Edit, add and build to the file until you have something to see and then save it. To veiw it, open any browser (Internet Explorer, Netscape, Aol, ...) and type the file path (e.g. "c:/windows/desktop/index.html") into the "location" bar on the browser.

All colors can be specified two ways, by name or number. Using a color by name is not recommended since there are a limited number of colors that can be used. "blue", "khaki", and "purple" are examples of named colors. I prefer the hexadecimal format for numbers, which means that the relative amount of red, green or blue is specified from 0 (no red, green or blue) to F (all red, green or blue). The Html format is "#RRGGBB" where R, G and B are red, green abd blue, respectively. Thus, "#0000ff" is solid blue and "#ff0000" is solid red. If you want to get a particular color, use my Color Generator, which generates 4,096 different colors and gives the hexadecimal number for each.

There are a great number of "modifiers" which will work in most tags you would want them to work in. To use them, you simply put them inside the tag you expect it might work in, et voilą, they work!

  • align='right' | 'center' | 'left' | 'absmiddle' | (maybe more) --- usually aligning text, images or tables.
  • valign='top' | 'bottom' | 'center' | (maybe more) --- vertical align for text in tables, images...
  • width='pixels' | '%' --- allows limits to be set for table widths, horizontal rules, images, etc.
  • height='pixels' | '%' --- allows height restrictions to be made in many of the same places as the "width" modifier.
  • text='#ff8833' --- changes color of text to #ff8833 in some places (tables, body...).
  • bgcolor="#rrggbb" --- changes background color in table cells, whole page, layers ...
  • background="image.gif" --- changes background to an image on page (maybe even table cells). Usually, if you can use the "bgcolor=" modifier, you can use the "background=" modifier.
  • src="image2.gif" --- "src" means "source" and can be images or whole files, such as "src=menu.html". It's other uses are a bit obscure.
  • name="a_name" --- many more advanced features, such as forms, layers and buttons can be named and called by name to accept data (this will be explored more in "forms and buttons").

Basic Structure of Html:


[ window | font | format | tables | links | lists | images | forms | layers ]

Below is an incomplete listing of the possible tags that I know of: (click on the linked tags for an example). Don't forget, nearly all of these links need to be "turned off" (e.g. </table>) except for the few mentioned above (img, li ...).

  • Font stuff

    • <html> --- defines the beginning of any Html document.
    • <head> --- defines the "head" (unseen part used for coding, such as javascript) of an Html document.
    • <body> --- defines the beginning of the "body" of the document (this is where text, tables, images, frames, and anything else goes).
    • <b> or <strong> --- causes text to be Boldface. The "strong" tag is more widely supported.
    • <i> or <em> --- causes text to be Italic. The "em" (for emphasis) tag is more widely supported.
    • <u> --- causes text to be Underlined
    • <strike> --- Strikeout text
    • <blink> --- causes blinking. Avoid this annoying tag at all cost!
    • <h3> ---

      Heading #3

      There are 6 heading sizes, h1 (largest) through h6 (smallest).
    • <big> --- makes words Big. Looks good on First Letters.
    • <small> --- makes words smaller.
    • <code> --- puts text in Code format.
    • <sub> --- puts text in Subscript format.
    • <sup> --- puts text in Superscript format.
up to
window


  • Format Stuff

    • <br> --- "break" creates new line.
    • <center> --- centers text, tables, forms, ...
    • <p> --- "paragraph" tag. <p> signals start of paragraph, </p> signals end. These tags are very versatile, since they allow you to justify text right, left, center, top or bottom simply by using the "align=" and "valign=" options mentioned in the inrtoduction of this page.
    • <blockquote> ---
      puts a paragraph into an indented square block.
    • <hr> --- creates a "horizontal rule" using "width=70%" here.
up to
window


  • Tables

    • <table> --- signals beginning of table. There are several common modifiers that can go inside this opening "table" tag:
      • "border=3"-- sets a border around the table 3px wide.
      • "cellspacing=5" -- sets space between table cells to 5px.
      • "cellpadding=7" -- sets space between cells edge and text to 7px.
      • "align='center' " -- centers table.
      • "bgcolor=" and "background=" (can also be used inside "td" tag for individual cell colors)
      • "width=" and "height=" (usually as a maximum percent, also used it "td")
    • <tr> --- signals beginning of a row.
    • <td> --- signals beginning of a column.
      (Prints example code to window above.)
up to
window


up to window


  • Lists

    • <li> --- gives a bullet point
    • <ul> --- signals beginning of unordered list (just bullet points), remember to turn these off! They can be "nested" (lists inside of lists). (see example) The bullet point style can be changed with a style sheet, but changes automatically when nested.
    • <ol> --- signals beginning of ordered list ("1. ","2. ","3. ",etc.).
      (Prints example code to window above.)
up to
window


  • Images

    • <img src='images/greenface.gif'> --- The image tag. Here's what you get:

    • <img src='images/greenface.gif' align='right' width=70 height=70'> --- or, with these modifiers:


up to
window


  • Forms and Buttons

    -- Forms can be complicated, so it's best to see the example below and study it carefully. Pay special attention to how the "name=" stuff works. Accessing the various boxes and areas can be done on the page in e.g. javascript for local operations, such as my color generator, but for submitting questionaires, signing guestbooks or any private or information to be written to a file requires a Common Gateway Interface (cgi), which you won't learn about here!

    • <form> --- defines beginning of a form
    • <input> --- this is where the type of or output is specified. Usage: "<input type="__">
      • button --- makes a "button"
      • radio --- makes a radio button. Only one can be checked at once, if they have the same name , i.e. "name='n' ".
        radio onoff
      • text --- makes a "text box" which can input or output numbers or words.
      • checkbox --- makes a "checkbox" to select multiple items.
        option 1option 2
      • password --- makes a password-style text box which shows letters as "****".
    • <select> --- Makes a select box. Syntax is as follows:
      <select name="choose" size="1">
      <option value="1" selected>Fall 1999
      <option value="2">Spring 1999
      </select>
      Choose:
    • <textarea> --- Creates a text area where text can be written or read by using the "document.name_of_form.name_of_textarea.value=" statment inside javascript code. This allows you to even write code to the box and then run it, like on this page. You can also modify the ".value" of the text area and then run it. Any words put between the <textarea> and </textarea> tags are put directly inside the textarea as is. The only thing that will do anything inside these tags is "\n", which is a new-line equivalent to the Html <br>. To run the stuff inside the text area, I used a button with the following code inside it: <input type="button" value="Preveiw code" onClick="document.write('document.form_name.textarea_name.value');">

up to window


[ window | font | format | tables | links | lists | images | forms | layers ]

Top of page