HTML (HyperText Markup Language)

Computer Methods in Chemical Engineering


There are many uses of world-wide web (WWW). They include commercial advertisement, resume (which is a form of self-advertisement), and unrestricted or restricted distribution of information. In this class, we use it to post homework assignments and solutions, distribute class handouts, save examples demonstrated in the class, and share any other information.

We will make a home page as part of this class' assignment. As in all other topics covered in this class, I shall teach by means of a demonstration, and you will best learn by actually doing it. In fact, I believe this is the only way.

In order to make your own WWW page, you need to first create a file with a text editor of your choice, as long as that editor can save document in an ascii/DOS/text/nondocument mode. You need to learn a set of commands called Hypertext Markup Language (HTML). Many places on the internet has information on this language. HTML commands are enclosed in angle brackets. They are inserted in the text file to control the display format. Graphic files can also be imbedded and displayed. If you have ever used a text formatter such as TeX or troff or if you have ever tried to control a printer by manually embedding printing commands, you will find that it is relatively straightforward to learn HTML. Summaries of HTML are available on, where else, the internet. I found the following links helpful. (Start with the first three links.)

I have collected the commands that I use in a test page, which serves as my own on-line reference. Newer versions of some commercial editors (including Microsoft Word), as well as some HTML editors specially created for writing HTML files, allow you to save documents directly as HTML files, thus saving you some agony. Netscape's Communicator (version 4) and Microsoft's Internet Explorer also each come with a composer. They will perform fine for you, although I have personally resisted using these specialized HTML editors because it is easier for me to learn the few commonly used HTML commands than to master yet another editor. Besides I enjoy the challenge of making things work and the resulting satisfaction when things do actually work. I do not know of any HTML editor that supports all HTML commands. Although there are many HTML commands, only a handful of basic ones suffice to get you started. You can always learn more to achieve fancier effects or compose prettier pages.

The best way to learn is by examples. As you browse the internet, note the pages that are particularly well designed or contain interesting effects. We tend to gain appreciation for aesthetics and artistic styles by viewing other people's pages critically. Unlike most programs for which you do not have access to the source codes, you have full access to all the files that you display with your internet browser, both the HTML source codes and the graphic files -- otherwise, you would not have been able to transfer them in the first place. You can view the source file on the fly with the "View Source" item under the View menu and compare it against the effect you see with the browser. In fact, I learned many neat tricks this way. You can also save them in your own computer to study them in detail. You may make references or links to other people's pages -- after all that is the heart of WWW. However, I cannot emphasize enough that you must not plagiarize other people's work. Too many web pages make links without providing much information. As a result, you can browse a lot but find very little useful information. Web is potentially a bottomless sinkhole of time. High quality, substantive web pages are few in number compared to the total number of pages out there, but it is quite refreshing when you do hit one. Avoid making links to unstable sources that are here today and gone tomorrow. I had to modify many of the links listed two paragraphs above, and I have no doubt that some will cease to work before the end of this semester. One of the disadvantages of the web is that some of the things need to be more stable.

In summary, the steps for setting up the WWW pages are as follows:

  1. Create ascii files. Most people choose to save files with an extension of ".html" or ".htm. (A three-letter .htm extension is for those who use DOS or Windows 3.x.) If you prefer working on your own PC/Mac, test and view the HTML files (e.g., foo.htm) you create by opening them from a browser by choosing the item "Open File" under the "File" menu or by entering "file:///C|/path/foo.htm" on the input line.
  2. Place files in a computer that is running a web server. You need to transfer files to a computer that is hooked up to the internet. That means a place a web server program has access to. Not all computers can send files to a requesting browser. A computer has to run a web server program. Setting up a server program is the system administrator's domain, and we will not deal with it in this class. With a modem, a dedicated phone line, and a server program, you can configure your PC at home to be a server, albeit with a bit of effort. Windows NT allows you to create your own server much more easily than Windows 9x/2K. Of course, if you prefer, you can create the files directly on the server computer. Place the files in a publicly accessible directory set up by the computer administrator. This directory is usually "/pub". For example, an input line "http://www.glue.umd.edu/~nsw" logs into a computer named glue.umd.edu and loads a file named "index.htm" residing in a subdirectory named "/pub" under the username nsw. Likewise, an input line "http://www.wam.umd.edu/~nsw" fetches /pub/index.htm from a computer named wam.umd.edu. When the web server cannot find "index.htm", it will subsequently attempt to find a file named "index.html". Failing to find neither file, the web server will return the directory listing. (As Unix is case sensitive, make sure you duplicate the file name exactly -- capitalize "W" in "Welcome" and append it with the ".html" extension, not just ".htm". The tilde sign "~" preceeding your login name tells the web server that it needs to travel down a few levels in the directory structure to get to your directory. For example, this very file is accessed with the URL:
    http://www.glue.umd.edu/~nsw/ench250/network.htm
    which is a short for:
    http://www.glue.umd.edu/afs/glue.umd.edu/home/ench/faculty/nsw/pub/ench250/network.htm
    Thus, the tilde sign"~" here saves the user from having to type a long series of directory path "/afs/glue.umd.edu/home/ench/faculty/nsw/pub/", where my files are actually placed under. Most undergraduate glue account holders have their files placed deep under /afs/glue.umd.edu/home/glue/ instead. All other files can be accessed by an explicit reference to the directory path and file name. For example: an input line "http://www.glue.umd.edu/~nsw/subdirectory/foo.html" fetches /pub/subdirectory/foo.html from a computer named glue.umd.edu. Note that the /pub subdirectory is among the ones that are automatically created for you in wam or glue when you first open your account, the other subdirectory being home, backup and mail. After you log in, wam and glue place you under the /home subdirectory in your user directory. To reach /pub after you login, travel up one directory level, then go down one level to /pub. For example, issuing "cd ../pub" will do.
  3. Test to ensure all links work as intended. At UMCP, the following URLs all point to the same file.

When you design your web page, keep in mind the users on the other side of the line. There are many things you can do to make your web page a bit more user-friendly. Keep things in reasonably digestible chunks while retain enough information on each page. I tend to be on the plain side when it comes to formatting because not all browsers support fancy tags. Stay close to the least common denominator. Likewise, I use graphics rather sparingly because it takes a long time to download these files, especially when I am at home using a modem. I am also constrained by the puny disk quota the system administrator allows me. Many graphics you find on the internet nowadays look jazzy but really do not add much to the information content. I especially resent being forced to view a large boring picture before text material is presented. Unless I am desperate for the information that may subsequently come up, my limited patience would have normally terminated the transmission. You can prevent this from happening to your page by adding "height=xxx" and "width=xxx" to the "img" tag. Most browsers will allocate the specified amount of space and go on with formatting, displaying the text material around the graphics first. After the text material has been displayed, the web browser will then go back to download graphics. The following html line


   <img src="foo.gif" alt="Photo" width=80 height=60>
saves 80X60 pixels for a graphics file named foo.gif. You can also use this technique to resize your original picture (whatever the original size) to fit into 80X60 pixels.

Finally, if you keep both a glue account and a wam account and want to update web pages on only one of them, I suggest that you include a simple index.htm in the second account to redirect a browser automatically to the first account. The first account will contain a file index.htm with its usual information, but the second account should contain a file index.htm with the following lines:


<meta http-equiv="refresh" content="0; url=http://www.wam.umd.edu/~xxx/">
<a href="http://www.wam.umd.edu/~xxx/">Go to My Home Page</a>


Return to Prof. Nam Sun Wang's Home Page
Return to Computer Methods in Chemical Engineering (ENCH250)

Computer Methods in Chemical Engineering -- HTML
Forward comments to:
Nam Sun Wang
Department of Chemical & Biomolecular Engineering
University of Maryland
College Park, MD 20742-2111
301-405-1910 (voice)
301-314-9126 (FAX)
e-mail: nsw@umd.edu ©1996-2006 by Nam Sun Wang
UMCP logo