1D0-61B practice question 12 of 15

You are modifying an existing Web page that needs to validate as HTML5 code. To create a rectangular hot-spot in an image map that links to www.xyz.com, which code would you nest inside the <map> </map> container tags?

Full set: 55 questions
Answer options
A:

A. shape="rectangle" coords="78, 0, 156, 75" href="http://www.xyz.com" alt="xyz"

B:

B. shape="rectangle" coords="78, 0, 156, 75" href="www.xyz.com" alt="xyz" />

C:

C. shape="rect" coords="78, 0, 156, 75" href="http://www.xyz.com" alt="xyz" />

Correct answer
D:

D. shape="rect" coords="78, 0, 156, 75" href=http://www.xyz.com />

Correct Answer:
C. C. shape="rect" coords="78, 0, 156, 75" href="http://www.xyz.com" alt="xyz" />
Explanation

To create a valid HTML5 rectangular hot-spot, the element must be used. The shape attribute's correct value for a rectangle is rect. The href attribute requires a full, absolute URL, including the protocol (e.g., http://), to link to an external site, and its value must be quoted. Crucially, for accessibility and HTML5 validation, the alt attribute is mandatory when the href attribute is present. Option C is the only choice that meets all these requirements: correct shape value, properly formatted URL, and inclusion of the required alt attribute.

Why Incorrect

A. The value for the shape attribute is incorrect. The standard value for a rectangle is rect, not rectangle, for HTML5 validation.
B. The shape attribute value is incorrect (rectangle instead of rect), and the href value is a relative path, not a full URL needed for an external link.
D. This option is missing the alt attribute, which is a mandatory attribute for the element when an href attribute is specified.

References

1. WHATWG HTML Living Standard: In the section on the element, the shape attribute is defined. It states, "The shape attribute, if specified, must have a value that is a case-insensitive match for one of 'circle', 'default', 'poly', or 'rect'." This confirms rect is the correct value.

Source: WHATWG HTML Living Standard, Section 4.8.15 The area element. (https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-shape)

2. WHATWG HTML Living Standard: The same section specifies the requirement for the alt attribute: "The alt attribute must be specified if the href attribute is present." This invalidates option D.

Source: WHATWG HTML Living Standard, Section 4.8.15 The area element. (https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-alt)

3. W3C HTML 5.2 Recommendation: This official specification also defines the valid keywords for the shape attribute, listing rect as the conforming value for a rectangle. It also states that the alt attribute is required on elements that have an href attribute.

Source: W3C HTML 5.2 Recommendation, Section 4.8.15 The area element. (https://www.w3.org/TR/html52/imagemap.html#the-area-element)

4. MDN Web Docs (Mozilla): While a developer resource, it is widely used in academic settings and reflects official standards. The page for confirms: "shape: The shape of the associated hot spot. The specifications for...HTML5 define the values rect, circle, poly, and default." and "alt: ...It is a required attribute for the element."

Source: MDN Web Docs, : The Image Map Area element. (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area)

Scroll to Top