|
Creating a simple web page Contents
The first thing to understand about HTML is that it is really a file format (i.e. a representation), not a programming language (i.e. a set of rules). HTML divides a text into labelled categories; it is up to a piece of software, i.e. a browser, to interpret these categories and provide a visual display. This is a fancy way of saying that the same HTML file will look different under different browsers. So, while text you label as <b> ("boldface") will probably display as bold in any browser, text you label as <h1> ("heading level one") will look different in Internet Explorer and Netscape Navigator. (This page, for instance, was designed and tested on Internet Explorer, and doesn't look quite right in Netscape.) Moreover, your web page will look different on different computers, even when they're running the same version of the same browser. That's because different computers have different fonts, different video cards, and different monitors; the monitors have different resolutions (number of dots), sizes (size of dots), and color depths (number of colors per dot). So you never know exactly where the bottom or right side of your page will be, or what color anything will show up as, on someone else's computer. So, if you're used to sharing your files by composing in a word processor on one computer, printing, and xeroxing, you're going to have to get used to forgoing a lot of control about how your document looks when you move to HTML. One way to learn about HTML is to look at the "source code" (HTML text file) of other people's web pages. In Internet Explorer, you can select "View | Source"; in Navigator, it's "View | Page Source". This is a good way to see how people achieve effects you like. In the following discussion, I'll format HTML expressions like this so they can be distinguished from regular text. HTML is ASCII text marked up with "tags". Tags are typed with a label surrounded by angled brakets. Tags specify how something should be formatted; for instance, <b> means "boldface the following text". Most tags also have corresponding end tags, prefixed with a forward slash: </b> means "stop boldfacing". Most tags also have "attributes" -- actually attribute-value pairs, written with an equals sign between them -- which specify additional properties of the item. For instance, <p> means "begin a new paragraph"; <p color="blue" textalign="right"> means "begin a paragraph with right alignment and blue text". The attributes go in any order after the tag label and before the closing bracket. Values are enclosed in quotation marks, unless they're simple numbers. HTML ignores any extra whitespace (spaces, tabs, carriage returns) you might insert in a document. For instance, if you try to add extra space between two paragraphs by typing extra carriage returns, you will only see one carriage return. On the plus side, you can use space to format your HTML code so it's readable without affecting the page.
HTML also ignores capitalization. However, be aware that for anything within quotes, capitalization might matter -- especially URLs in links. What follows is an example of a minimal HTML page, illustrating the use of the required tags <html>, <head>, <title>, and <body> to structure the file. The material between the <!-- and --> brackets is "comments" -- text you can use to comment on parts of your document without affecting what is displayed in the browser. <html> <!-- This tells the browser this file is a web page. Required. --> <head> <!--
This is for some preliminary material. Required. --> <body> <!-- Here we go -- the actual contents of the page. Attributes placed in this tag (such as font and color) affect the whole page. --> <p>This webpage contains everything there is to
know about language.</p> </body> <!--
End of the body section. --> An HTML file must be a "plain ASCII" file. You can type it in a word processor if you choose the "save as text" option; however, most people prefer to play it safe by typing it in a text editor that doesn't add formatting, such as Notepad.exe (found in the Accessories folder on Windows systems). If you want, you can copy the above HTML code to the clipboard, paste it into Notepad, save the file with the extension ".htm" or ".html", and double-click it in Windows Explorer to view it in your browser. While you're at it, change the title and the text between the paragraph tags, and you've composed your first web page!
It isn't necessary to type all of this material by hand. There are several categories of alternatives:
See LSIT's "Web Authorware Help" links at WebHelp for some comments on the plusses and minuses of various of these tools.
For more information about what you can do with HTML and related issues, see More HTML and the links in Additional Resources.
|
|
|||||||||||||||||||||||