Using Good Form


Tags aren't the only things that make a good Web page. As you continue through the lessons in this book, you'll discover that while HTML was very forgiving, XHTML must conform to the rules. Though current versions of the most popular browsers will recognize your intentions even if you use incorrect tags (or enter the correct tags in the wrong order), later versions will not. You'll want to move beyond the novice level now and follow some basic Web coding principles to conform to XHTML's standards. Following is a brief list of those principles, but you'll learn more in later lessons:

  • Include all the required XHTML elements that you learned in this lesson You might want to create a template for yourself that already includes these tags. You can use the XHTML document created in the "XHTML Requirements" section as a template. Whenever you create a new Web page; open your template file, add your new text, and save the new file.

  • Use lowercase for all tags To the browser, <HEAD>, <Head>, and <head> all mean the same thing. (That won't always be true.) Use the same lowercase spelling for all your commands and you won't be caught having to recode your pages as the standard evolves.

  • Never use spaces in filenames Older computer systems have trouble reading filenames that include spaces (for example, my first page.htm). Instead, you can use a couple of file management tricks to replace the spaces:

    • Use an underscore (_) to represent spaces (for example, my_first_page.htm).

    • Use initial capital letters to indicate new words in a filename (for example, MyFirstPage.htm).

Table 2.1 shows a list of the tags that you learned in this lesson. A similar table of new HTML tags appears at the end of other lessons.

Table 2.1. HTML Tags Used in This Lesson

HTML Tag

Closing

Description of Use

<!DOCTYPE>

 

Begins each XHTML document and includes a reference to the Strict, Transitional, or Frameset variation.

<html>

</html>

Surrounds all the text in an HTML file. XHTML documents must include the xmlns, xml:lang, and lang attributes.

<head>

</head>

Contains information about the document. Must include the <title> tag.

<title>

</title>

Identifies the title of the page.

<body>

</body>

Surrounds the text of the page.


In this lesson, you've learned:

  • Any text editor, including Microsoft Notepad, can be used to create Web pages (or HTML documents).

  • All HTML documents are separated into two parts: the head and the body.

  • Every HTML document must include the <html> tag and end with its complement, the </html> tag.

  • Every XHTML document must include a valid variation of the <!DOCTYPE> tag before the <html> tag.

  • All HTML tags (except the <!DOCTYPE> tag) should be typed in lowercase.



Sams Teach Yourself HTML in 10 Minutes
Sams Teach Yourself HTML in 10 Minutes (4th Edition)
ISBN: 067232878X
EAN: 2147483647
Year: 2004
Pages: 151
Authors: Deidre Hayes

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