Now that you've had an introduction to HTML and a taste of creating your first very simple Web page, here's a workshop that will guide you toward more of what you'll learn. A couple of questions and answers that relate to HTML formatting are followed by a brief quiz and answers about HTML. The exercises prompt you to examine the code of a more advanced page in your browser.
Can I do any formatting of text in HTML?
You can do some formatting to strings of characters; for example, you can make a word or two bold. Tags in HTML 3.2 (the predecessor to HTML 4.0) enabled you to change the font size and color of the text in your Web page (for readers using browsers that support the tagsincluding Netscape and Microsoft Internet Explorer), but most of these tags have given way to CSS formatting in HTML 4.01 and XHTML 1.0. You'll learn some formatting tricks in Day 6.
I'm using Windows. My word processor won't let me save a text file with an extension that's anything except .txt. If I type in index.html, my word processor saves the file as index.html.txt. What can I do?
You can rename your files after you've saved them so that they have an html or htm extension, but having to do so can be annoying if you have a large number of files. Consider using a text editor or HTML editor for your Web pages.
What does HTML stand for?
What's the primary function of HTML?
Why doesn't HTML control the layout of a page?
Which version of HTML provides the lowest common denominator of HTML tags?
What's the basic structure of an HTML tag?
HTML stands for Hypertext Markup Language.
HTML defines a set of common styles for Web pages (headings, paragraphs, lists, tables, character styles, and more).
HTML doesn't control the layout of a page because it's designed to be cross- platform. It takes the differences of many platforms into account and allows all browsers and all computer systems to be on equal ground.
The lowest common denominator for HTML tags is HTML 2.0, the oldest standard for HTML. This is the set of tags that all browsers must support. HTML 2.0 tags can be used anywhere.
Most HTML elements consist of opening and closing tags, and they surround the text that they affect. The tags are enclosed in brackets (<>). The beginning tag turns on a feature, and the ending tag, which is preceded by a forward slash (/), turns it off.
Before you actually start writing a meatier HTML page, getting a feel for what an HTML page looks like certainly helps. Luckily, you can find plenty of source material to look at. Every page that comes over the wire to your browser is in HTML (or perhaps XHTML) format. (You almost never see the codes in your browser; all you see is the final result.)
Most Web browsers have a way of letting you see the HTML source of a Web page. If you're using Internet Explorer 6.0, for example, navigate to the Web page that you want to look at. Choose View, Source to display the source code in a text window. In Netscape, choose View, Page Source.
In some browsers, you can't directly view the source of a Web page, but you can save the current page as a file to your local disk. In a dialog box for saving the file, you might find a menu of formatsfor example, Text, PostScript, or HTML. You can save the current page as HTML and then open that file in a text editor or word processor to see the HTML source.
Try going to a typical home page and then viewing its source. For example, Figure 3.3 shows the home page for Google, a popular search page at http://www.google.com/.
Figure 3.3 Google home page.
The HTML source code of the Google home page looks something like Figure 3.4.
Figure 3.4 Some HTML source code.
Try viewing the source of your own favorite Web pages. You should start seeing some similarities in the way pages are organized and get a feel for the kinds of tags that HTML uses. You can learn a lot about HTML by comparing the text onscreen with the source for that text.