HTML and CSS Reference
In-Depth Information
Name
img
Synopsis
<img>
(XHTML:
<img/>
or
<img />
)
Represents an image in the content flow. The
src
and
alt
attributes are required.
Usage
Categories:
Flow content, phrasing content, embedded content, palpable content, interactive content if
it has a
usemap
attribute
Permitted contexts:
Where embedded content is expected
Permitted content:
Empty
Start/end tags:
This is an empty (void) element, meaning it has only a start tag and may not have any con-
tents. In HTML, the end tag is forbidden. In XHTML, the element must be closed with a
trailing slash (
<img/>
or
<img />
).
Attributes
HTML5 Global Attributes
alt="
text
text
"
Required
. Provides a string of alternative text that appears when the image is not or can-
not be displayed.