Chad Lawrence

Web Development for Tech Applications (TECH 64095-001)

clawre13@kent.edu

Chapter 04 - Introduction to XHTML

4.1 State whether each of the following is true or false. If false, explain why.

  1. An ordered list cannot be nested inside an unordered list. False. An ordered list can be nested inside an unordered list and vice versa.
  2. XHTML is an acronym for XML HTML. False. XHTML is an acronym for Extensible HyperText Markup Language.
  3. Element br represents a line break. True.
  4. Hyperlinks are denoted by link elements. False. Hyperlinks are denoted by a elements.
  5. The width of all data cells in a table must be the same. False. You can specify the width of any column, either in pixels or as a percentage of the table width.
  6. You are limited to a maximum of 100 internal links per page. False. You can have an unlimited number of internal links.

4.2 Fill in the blanks in each of the following:

  1. The hr element inserts a horizontal rule.
  2. A superscript is marked up using element sup and a subscript is marked up using element sub.
  3. The least important heading element is h6 and the most important heading element is h1.
  4. Element ul marks up an unordered list.
  5. Element p marks up a paragraph.
  6. The type = "reset" attribute in an input element inserts a button that, when clicked, clears the contents of the form.
  7. The tr element marks up a table row.
  8. Asterisks are usually used as masking characters in a password box.

4.3 Use XHTML to create a document that contains the following text:

Internet and World Wide Web How to Program: Fourth Edition
Welcome to the world of Internet Programming.
We have provided topical coverage for many Internet-related topics.

Use h1 for the title (the first line of text), p for text (the second and third lines of text) and sub for each word that begins with a capital letter (except the title). Insert a horizontal rule between the h1 element and the p element. Open your new document in a web browser to view the marked-up document.

4.3 Answer

4.4 Why is the following markup invalid?

<p>Here is some text...
<br />
<p>And some more text...</p>

The first p element has not been closed.

4.5 Why is the following markup invalid?

<p>Here is some text... <br>
And some more text... </p>

The br element has not been closed.

4.6 An image named deitel.gif is 200 pixels wide and 150 pixels high. Write an XHTML statement using the width and height attributes of the img element to perform each of the following transformations:

  1. Increase the size of the image by 100 percent.
  2. Increase the size of the image by 50 percent.
  3. Change the width-to-height ratio to 2:1, keeping the width attained in part (a).

4.6 Answer

4.7 Create a link to each of the following:

  1. The file index.html, located in the files directory. 4.7a Answer
  2. The file index.html, located in the text subdirectory of the files directory. 4.7b Answer
  3. The file index.html, located in the other directory in your parent directory. 4.7c Answer
    [Hint: .. signifies parent directory]
  4. The President's e-mail address (president@whitehouse.gov). president@whitehouse.gov
  5. The file named README in the pub directory of ftp.cdrom.com. [Hint: Use ftp://.] ftp.cdrom.com/pub/README.txt (I can't access ftp.cdrom.com)

4.8 Create an XHTML document containing three ordered lists: ice cream, soft serve and frozen yogurt. Each ordered list should contain a nested, unordered list of your favorite flavors. Provide a minimum of three flavors in each unordered list.

4.8 Answer

4.9 Create an XHTML document that uses an image as an e-mail link. Use attribute alt to provide a description of the image and link.

4.9 Answer

4.10 Create an XHTML document that contains links to your favorite websites. Your page should contain the heading "My Favorite Web Sites."

4.10 Answer

4.11 Create an XHTML document that contains an unordered list with links to all the examples presented in this chapter. [Hint: Place all the chapter examples in one directory.]

4.11 Answer

4.12 Identify each of the following as either an element or an attribute:

  1. html - element
  2. width - attribute
  3. href - attribute
  4. br - element
  5. h3 - element
  6. a - element
  7. src - attribute

4.13 State which of the following statements are true and which are false. If false, explain why.

  1. A valid XHTML document can contain uppercase letters in element names. False. Uppercase letters in element names is a syntax error.
  2. Tags need not be closed in a valid XHTML document. False. All tags must be enclosed for a valid XHTML document.
  3. XHTML documents can have the file extension .htm. True.
  4. Valid XHTML documents can contain tags that overlap. False. Tags may be nested but may not overlap.
  5. &less; is the character entity reference for the less-than (<) character. False. &lt; is the character entity for the less-than (<) character.
  6. In a valid XHTML document, <li> can be nested inside either <ol> or <ul> tags. True.

4.14 Fill in the blanks in each of the following:

  1. XHTML comments begin with <!-- and end with -->.
  2. In XHTML, attribute values must be enclosed in quotes.
  3. &amp; is the character entity reference for an ampersand.
  4. Element strong can be used to bold text.

4.15 Categorize each of the following as an element or an attribute:

  1. width - attribute
  2. td - element
  3. th - element
  4. name - attribute
  5. select - element
  6. type - attribute

4.16 Create the XHTML markup that produces the table shown in Fig 4.16. Use <em> and <strong> tags as necessary. The image (camel.gif) is included in the Chapter 4 examples directory that can be downloaded from http://www.deitel.com/books/iw3htp4/.

table 4.16

4.16 Answer

4.17 Write an XHTML document that produces the table shown in Fig 4.17.

table 4.17

4.17 Answer

4.18 A local university has asked you to create an XHTML document that allows prospective students to provide feedback about their campus visit. Your XHTML document should contain a form with text boxes for a name, address, and e-mail. Provide checkboxes that allow prospective students to indicate what they liked most about the campus. The checkboxes should include: students, location, campus, atmosphere, dorm rooms and sports. Also, provide radio buttons that ask the prospective students how they became interested in the university. Options should include: friends, television, Internet, and other. In addition, provide a text area for additional comments, a submit button and a reset button.

4.18 Answer

4.19 Create an XHTML document titled "How to Get Good Grades." Use <meta> tags to include a series of keywords that describe your document.

4.19 Answer