|
Writing HTML | About | FAQ | References | Tags | Lessons | previous | next |1. Creating Your First HTML DocumentYou are about to embark on a journey that will transform you from a mere Internet Surfer of the Web to an Internet Author of Multimedia! ObjectivesAfter this lesson you will be able to:
LessonNow that you know what HTML is, let's start using it. (Quick quiz -- what do those letters stand for? If you read the previous lesson you would know!). What are HTML tags?When a web browser displays a page such as the one you are reading now, it reads from a plain text file, and looks for special codes or "tags" that are marked by the < and > signs. The general format for a HTML tag is: <tag_name>string of text</tag_name> As an example, the title for this section uses a header tag: <h3>What are HTML tags?</h3> This tag tells a web browser to display the text What are HTML tags? in the style of header level 3 (We'll learn more about these tags later). HTML tags may tell a web browser to bold the text, italicize it, make it into a header, or make it be a hypertext link to another web page. It is important to note that the ending tag, </tag_name> contains the "/" slash character. This "/" slash tells a web browser to stop tagging the text. Many HTML tags are paired this way. If you forget the slash, a web browser will continue the tag for the rest of the text in your document, producing undesirable results (as an experiment you may want to try this later). NOTE: A web browser does not care if you use upper or lower case. For example, <h3>...</h3> is no different from <H3>...</H3> Unlike computer programming, if you make a typographical error in HTML you will not get a "bomb" or "crash" the system; your web page will simply look, well... wrong. It is quick and easy to go inside the HTML and make the changes. Your browser has a small but open vocabulary! An interesting aspect of HTML is that if the browser does not know what to do with a given tag, it will ignore it! For example, in this document you are viewing, the header tag for this section really looks like this: <wiggle><h3>What are HTML tags?</h3></wiggle> but since your browser probably does not support a <wiggle> tag (I made it up, perhaps in the future it could cause the text to wave across the screen?), it proceeds with what it knows how to do. If I were programming a new web browser, I might decide to add the functionality for the <wiggle> tag into my software. Opening Up Your WorkspaceTo complete the lessons in this tutorial, you should create a second web window (this allows you to keep this window with the lesson instructions and one window as your "workspace"), plus open your text editor application in a third window. NOTE: This is a good place to remind you that we will provide directions that are somewhat general as the menu names and file names can differ depending on which web browser you are using. If our instructions say, "Select Open Location... from the File Menu" and your web browser does not have that exact choice, try to find the closest equivalent option in your own web browser. So you will want to be pretty comfortable jumping between different applications and windows on your computer. Another option is to print out the lesson instructions (but we really do not want to promote that kind of excessive tree carnage). Here are the steps for setting up your "workspace":
If you are just starting out, we most STRONGLY recommend that you use the simplest text editor available -- SimpleText for the Macintosh or the Windows NotePad. Why not use those nifty HTML editors? It is sound instructional design that you first learn the concepts and THEN look for shortcuts or helpers that make the work less tedious. Also, it will help you if you first create a new directory/folder on your computer that will be your work area. You can call it workarea or myspace or whatever you like; just make sure that you keep all of the files you create in this one area. It will make your life simpler... well, at least while working on this tutorial! Creating Your HTML DocumentAn HTML document contains two distinct parts, the head and the body. The head contains information about the document that is not displayed on the screen. The body then contains everything else that is displayed as part of the web page. The basic structure then of any HTML page is: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <!-- header info used to contain extra information about this document, not displayed on the page --> </head> <body> <!-- all the HTML for display --> : : : : : : </body> </html> The very first line: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> is not technically required, but is a code that tells the browser what version of HTML the current page is written for. For more information, see the W3C Reference Specification. Enclose all HTML content within <html>...</html> tags. Inside is first your <head>...</head> and then the <body>...</body> sections. Also note the comment tags enclosed by <!-- blah blah blah -->. The text between the tags is NOT displayed in the web page but is for information that might be of use to you or anyone else who might look at the HTML code behind the web page. When your web pages get complicated (like you will see when we get into tables, frames, and other fun stuff about 20 lessons from now!), the comments will be very helpful when you need to update a page you may have created long ago. Here are the steps for creating your first HTML file. Are you ready?
Displaying Your Document in a Web Browser
Check Your WorkCompare your document with a sample of how this document should appear. After viewing the sample, use the back button on your web browser to return to this page. If your document was different from the sample, review the text you entered in your text editor. A common mistake we hear is, "I cannot see the title!" You shouldn't! The text within the <title>...</title> tag is NOT displayed on the web page; you should see it in the title bar of the web browser window. The most common mistake that beginners make here is that they try using a word processing program to type HTML and then are unable to open it in their browser, or if it does, the page is full of odd garbage characters. When you are starting out, we urge you to use the most basic text editor such as the Windows NotePad or SimpleText for Macintosh. Look for shortcuts later! If you are looking for some free/cheap alternative text editors, our recommendations are EditPad (for Windows) and BBEdit Lite (for Macintosh) Review Topics
Independent PracticeThink of a topic for your own web page. Now create your own HTML text file that includes a <title> tag and a few introductory sentences. Save the HTML file and reload it in your web browser. You might want to create a different folder/directory for this file so you do not get it mixed up with all of the volcano pages you will create for this tutorial. Keep this file handy as you will add to it in later lessons. Coming Next....Your first web page is done! But, to be honest, it is pretty short and not very exciting! In the next lesson you will modify and update your HTML document. GO TO.... | Lesson Index | previous: "Standardly Speaking" | next: "Modifying HTML" |
Writing HTML: Lesson 1: Creating Your First HTML Document |