|
Topic: HTML Basic Structure of a Web Page Crank Out a New Text File So, to get to the point at long last, all you really need to do to get started is fire up your favorite text editor and launch a new document-if the program doesn't do that for you automatically, as most do. (Of course, that isn't to say there aren't other, equally important, accouterments you may need. For me, a good, strong cup of java is a must. Other optional HTML accessories include the appropriate mood music-something by The Spinners, perhaps?-a copy of Feel the Fear and Do It Anyway, and semi-important things like your creativity and imagination.) If you prefer, it's okay to use a word processor such as Windows' Write, Windows 95's WordPad, or Microsoft Word. One caveat, though: don't try to format the document in any way (such as adding italics or centering paragraphs). Not only do you run the risk of having a browser choke on these extra formatting codes, but every Web browser on the face of the Earth will completely ignore your efforts. Remember, the only way to make a browser do your bidding and display your Web page properly is to use the appropriate HTML codes. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>My first HTML document</TITLE> </HEAD> <BODY> <P>Hello world! </BODY> </HTML>
As a public service (it's a tough job but, hey, somebody's gotta do it), I've compiled the appropriate instructions from a few popular browsers for loading a file from your hard disk:
As I mentioned earlier, the magic of the Web is wrought by browser programs that read text files and then decipher the HTML nuggets that you've sprinkled hither and thither. These HTML tidbits are markers-called tags-that spell out how you want things to look. For example, if you want a word on your page to appear in bold text, you surround that word with the appropriate tags for boldfacing text. In general, tags use the following format: <TAG>The text to be affected by the tag</TAG> The TAG part is a code (usually a one- or two-letter abbreviation, but sometimes an entire word) that specifies the type of effect you want. You always surround these codes with angle brackets <>; the brackets tell the Web browser that it's dealing with a chunk of HTML and not just some random text. For example, the tag for bold is <B>. So if you want the phrase "BeDazzler Home Page" to appear in bold, you type the following into your document: <B>BeDazzler Home Page</B> The first <B> says to the browser, in effect, "Listen up, Browser Boy! You know the text that comes after this? Be a good fellow and display it in bold." This continues until the browser reaches the </B>. The slash (/) defines this as an end tag; this lets the browser know it's supposed to stop what it's doing. So the </B> tells the browser, "Okay, okay. Ixnay on the oldbay!" As you'll see, there are tags for lots of other effects, including italics, paragraphs, headings, page titles, lists, and lots more. HTML is just the sum total of all these tags. The <TITLE> TagTo define a title, you surround the text with the <TITLE> and </TITLE> tags. For example, if you want the title of your page to be "My Home Sweet Home Page," you enter it as follows: <TITLE>My Home Sweet Home Page</TITLE> Note that you always place the title inside the head section, so your basic HTML document now looks like so: <HTML> <HEAD> <TITLE>My Home Sweet Home Page</TITLE> </HEAD> <BODY> </BODY> </HTML> Title Dos and Don'ts Here are a few things to keep in mind when thinking of a title for your page:
How to Do Paragraphs
As I mentioned above, carriage returns aren't worth a hill of beans in the World Wide Web. If you type one line, press Enter, and then type a second line, the browser will simply run the two lines together, side by side. <HTML> <HEAD> <TITLE>My Home Sweet Home Page</TITLE> </HEAD> <BODY> This text appears in the body of the Web page. This is the second line (sort of). <P> This is the third line. </BODY> </HTML>
|