Workshop
You’ve learned a lot in this lesson, and the following workshop will 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 only tag that is required in HTML5 is the <title> tag. But it’s a good idea to get into the habit of using the structure tags now. Including these tags ensures that browsers handle your markup properly. 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’ll 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. In fact, 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 are used to 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 is used to indicate the title of a web page in a browser’s title bar and bookmarks. It is also used by search engines. 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 using CSS to style your text. 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.
- 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 really adventurous, complete the page’s content and include lists where you think they enhance the page. This exercise will help prepare you for Lesson 5, “Organizing Information with Lists.”