PrepAway - Latest Free Exam Questions & Answers

Which of the following attributes of the img tag is required for strict XHTML compliance while embedding image

Which of the following attributes of the img tag is required for strict XHTML compliance while
embedding images in a Web page?

PrepAway - Latest Free Exam Questions & Answers

A.
alt

B.
src

C.
id

D.
xml:lang

Explanation:
The <img> tag is used to embed an image in an HTML page. Images are linked to HTML pages and
are not technically inserted into an HTML page. The <img> tag creates a holding space for the
referenced image. The <img> tag has two required attributes: src and alt. The <img> tag is supported
in all major browsers. It is not required to put an end tag in HTML, but in XHTML, the <img> tag must
be properly closed. The alt tag is acceptable for HTML, but it is required for XHTML. For example:
<img src=”image1.gif” alt=”Image is loading” />
Answer B is incorrect. This attribute specifies the URL of an image.
Answer D is incorrect. In XHTML documents, this attribute specifies a language code for the content
in an element.
Answer C is incorrect. This attribute specifies a unique id for an element.


Leave a Reply