<img>
img represents an image. This element has no content in itself; it requires the source (src) attribute.
The img is considered an empty element. Most empty elements are self-closing: they do not require a closing tag, e.g., <hr>. HTML and xHTML have different methods:
- Element tag:
<img>- Closure:
- HTML 4.01 - <img>
- HTML 5 - Either closure type
- xHTML 1.0 - <img(Single space) />
- Example [Alternate Text (
alt) Attribute only]: -
- Code [HTML 4.01]:
-
<p><img alt="This is an IMG element lacking the SRC attribute which means you are reading the ALT attribute's text."></p> - Code [xHTML 1.0]:
-
<p><img alt="This is an IMG element lacking the SRC attribute which means you are reading the ALT attribute's text." /></p>
- Example [Basic]:
-
An Allegorical image representing for when Tinny and Woody Words are used in a single sentence:
- Code [HTML 4.01]:
-
<p>An Allegorical image representing for when Tinny and Woody Words are used in a single sentence:</p> <p><img src="/images/article-illustratives/maskboys_S.png" width="341" height="402" alt="1950's photograph of two boys wearing large papier-mâché head pieces."> </p> - Code [xHTML 1.0]:
-
<p>An Allegorical image representing for when Tinny and Woody Words are used in a single sentence:</p> <p><img src="/images/article-illustratives/maskboys_S.png" width="341" height="402" alt="1950's photograph of two boys wearing large papier-mâché head pieces." /> </p>
