FunctionX Tutorials Logo

HTML Structure

 

Introduction

 
A file in HTML is first of all, a file saved with a recognizable extension. The most common extension is htm as the traditional format of Microsoft Windows files. The other extension that is s valid is html. Any one of these two extensions makes it a valid HTML file. If the file you are working on has already been saved, it should have a valid extension already. Otherwise, after creating a text file, to save it as HTML, make sure you provide a valid extension.

HTML works by delivering two types of items to the browser: The items to display and the instructions on how to display those items. Everything in HTML is given to the browser as text. You can therefore display text “as is”.

Practical Learning: Creating an HTML file

  1. We will first need a folder to work with.
    • If you are using Microsoft Windows 9X, Me, or XP Home Edition, create a folder on the C:\ drive and call it htmltutorial
    • If you are using another operating system, create a folder or directory called htmltutorial where you can easily locate it.
  2. Start your text editor.
    • If you are using Microsoft Windows, to start Notepad, click Start -> Programs -> Accessories -> Notepad.
    • If you are using Linux, start one of the text editors (Linux appears to have a lot of them) such as emacs or vi
  3. To have text to display, in the empty window, type the following:
     
    A stand-alone workstation is a common computer designed for home use or small office. Typically, such a computer does not communicate with others. It assumes its work and manages everything between the machine being used and the user.
     
    Notepad
  4. To save the file, on the main menu, click File -> Save 
  5. Locate the htmltutorial folder or directory you created. Display it in the Save In combo box.
  6. Change the Save As Type or File Type combo box to All Files.
  7. Set the name of the file to exo1.htm
     
  8. Click Save.
     

Previewing an HTML File

 
There are different ways you can preview an HTML file. First you will need a browser. The two most popular browsers used on Microsoft Windows and Apple operating systems are Netscape and Microsoft Internet Explorer. You can get these browsers free from their corporate web sites. For example, you can get Netscape here.

Most, if not all, Linux distributions ship with Netscape and the Konqueror browsers.

To preview an HTML file, you can display it in My Computer, Windows Explorer, or the Home Directory windows. After displaying the folder or the directory that contains the file, double-click the file. If the browser is already opened, on the main menu, click File -> Open. Locate the folder or directory where the file was saved and select the HTML file you want to preview.

Practical Learning: Previewing an HTML file

  1. Open My Computer, Windows Explorer, or your Home Directory window.
  2. Locate the folder or directory where you saved the exo1.htm file to display it.
  3. Double-click the file:
     
    Page Preview
  4. A browser should open with the file. After viewing the file, close the browser.
 
From now on, whenever you are asked to create a folder, directory or file, use the approach we used here. Find out how your operating system handles files.

Notice that, whenever you double-click an HTML file, the operating system launches your default browser. If you have more than one browser and would like to change what browser is your default, find out how this can be done for your operating system. In Microsoft Windows, this can work by changing what application is associated with the htm extension, that is, what application is configured to open files with HTM or HTML extensions. In Windows Explorer of MS WinXP, you can click Tools -> Folder Options, click File Types; in the Registered File Types list box, scroll down and click HTM; in the Details for 'HTM' Extension section, on the right side of Opens With;, click Change; in the Programs list, select your desired browser, if your desired browser doesn't show in the list, click the Browse button; notice that Netscape is located in C:\Program Files\Netscape\Netscape 6\netscp6.exe 

 

Previous Copyright © 2004-2007 FunctionX, Inc. Next