Workshop
You've learned a lot in this lesson, and the following workshop can help you remember some of the most important points. I've anticipated some of the questions you might have in the first section of the workshop.
Q&A
-
Q In some web pages, I've noticed that the page structure tags (<html>, <head>, <body>) aren't used. Do I really need to include them if pages work just fine without them?
A Most browsers handle plain HTML without the page structure tags. The XHTML 1.0 recommendation requires that these tags appear in your pages. It's a good idea to get into the habit of using them now. Including the tags allows your pages to be read by more general SGML tools and to take advantage of features of future browsers. And using these tags is the correct thing to do if you want your pages to conform to true HTML format.
-
Q Is the <p> tag the general-purpose tag for use when styling a page?
A No. The <div> tag is the general purpose tag for containing content on a page. The <p> tag is intended specifically to hold paragraphs of text. There are many tags that are not valid when placed within a <p> tag, including <div>. You learn more about <div> in Lesson 7, "Formatting Text with HTML and CSS."
-
Q Is it possible to put HTML tags inside comments?
A Yes, you can enclose HTML tags within comments, and the browser will not display them. It's common to use comments to temporarily hide sections of a page, especially when testing things. Programmers (and web developers) generally refer to this as "commenting it out."
Quiz
-
What three HTML tags describe the overall structure of a web page, and what do each of them define?
-
Where does the <title> tag go, and what is it used for?
-
How many different levels of headings does HTML support? What are their tags?
-
Why is it a good idea to use two-sided paragraph tags, even though the closing tag </p> is optional in HTML?
Quiz Answers
- The <html> tag indicates that the file is in the HTML language. The <head> tag specifies that the lines within the beginning and ending points of the tag are the prologue to the rest of the file. The <body> tag encloses the remainder of your HTML page (text, links, pictures, and so on).
- The <title> tag indicates the title of a web page in a browser's bookmarks, hotlist program, or other programs that catalog web pages. This tag always goes inside the <head> tags.
- HTML supports six levels of headings. Their tags are <h1 .. /h1> through <h6 .. /h6>.
- The closing </p> tag becomes important when aligning text to the left, right, or center of a page. (Text alignment is discussed in Lesson 7.) Closing tags also are required for XHTML 1.0.
Exercises
-
Using the Camembert Incorporated page as an example, create a page that briefly describes topics that you would like to cover on your own website. You'll use this page to learn how to create your own links in Lesson 5.
-
Create a second page that provides further information about one of the topics you listed in the first exercise. Include a couple of subheadings (such as those shown in Figure 4.2). If you feel adventurous, complete the page's content and include lists where you think they enhance the page. This exercise can also help prepare you for Lesson 5.