Workshop


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.

Q&A

Q

Can I do any formatting of text in HTML?

A

You can do some formatting to strings of characters; for example, you can make a word or two bold. Pretty much all browsers support tags for formatting text (most were added in HTML 3.2), 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 Lesson 6.

Q

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?

A

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.

Quiz

1.

What does HTML stand for? How about XHTML?

2.

What's the primary function of HTML?

3.

Why doesn't HTML control the layout of a page?

4.

Which version of HTML provides the lowest common denominator of HTML tags?

5.

What's the basic structure of an HTML tag?

Quiz Answers

1.

HTML stands for Hypertext Markup Language. XHTML stands for Extensible HyperText Markup Language.

2.

HTML defines a set of common styles for web pages (headings, paragraphs, lists, tables, character styles, and more).

3.

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.

4.

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.

5.

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.

Exercises

1.

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.

Tip

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 Craigslist, a free online classified ads service search page at http://www.craisglist.org/.

Figure 3.3. Craigslist home page.


The HTML source code looks something like Figure 3.4.

Figure 3.4. Some HTML source code.


2.

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.




Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition)
ISBN: 0672328860
EAN: 2147483647
Year: 2007
Pages: 305

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net