Name
img — HTML 4.01 | HTML5
Synopsis
HTML: <img>; XHTML: <img/> or <img />
Places an image on the page. The src
and alt
attributes are required. Many attributes
of the img
element have been
deprecated in favor of Cascading Style Sheets for presentation and
positioning.
Start/End Tags
This is an empty element. In HTML, the end tag is forbidden. In XHTML, the element must be closed with a trailing slash as just shown. Developers may include a space character before the slash for backward compatibility with older browsers.
Attributes
Core, Internationalization, Events, HTML5 Global Attributes
align="bottom|left|middle|right|top"
Deprecated. Not in HTML5. Specifies the alignment of an image using one of the following values:
Value
Resulting alignment
bottom
Aligns the bottom of the image with the text baseline. This is the default vertical alignment.
left
Aligns the image on the left margin and allows subsequent text to wrap around it.
middle
Aligns the text baseline with the middle of the image.
right
Aligns the image on the right margin and allows subsequent text to wrap around it.
top
Aligns the top of the image with the top of the tallest object on that line.
alt="
text
"
Required. Provides a string of alternative text that appears when the image is not displayed. Browsers may display this text as a “tool tip” when the mouse rests on the image.
border="
number
"
Deprecated. Not in HTML5. Specifies the width (in pixels) of the border that surrounds a linked image.
height="
number
"
Specifies the height of the image ...
Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.