Escolar Documentos
Profissional Documentos
Cultura Documentos
The <img> tag has two required attributes: src and alt. Note: Images are not technically inserted into an HTML page, images are linked to HTML pages. The <img> tag creates a holding space for the referenced image. Tip: To link an image to another document, simply nest the <img> tag inside <a> tags.
Attribute Values
Value text Description Specifies an alternate text for an image.
Attribute alt
Value text
Syntax
<img alt="text" />
The text should describe the image if the image contains information The text should explain where the link goes if the image is inside an <a> element
Use alt="" if the image is only for decoration src URL Specifies the URL of an image
Syntax
Possible values:
An absolute URL - points to another web site (like src="http://www.example.com/image.gif") A relative URL - points to a file within a web site (like src="image.gif")
Optional Attributes
Attribute align Value top bottom middle left right Description Use styles instead. Specifies the alignment of an image according to surrounding elements The align attribute specifies the alignment of an image according to the surrounding element. The <img> element is an inline element (it does not insert a new line on a page), meaning that text and other elements can wrap around it. Therefore, it can be useful to specify the alignment of the image according to surrounding elements. border height hspace pixels pixels % pixels Deprecated. Use styles instead. Specifies the width of the border around an image Specifies the height of an image Deprecated. Use styles instead. Specifies the whitespace on left and right side of an image Specifies an image as a server-side image-map Specifies the URL to a document that contains a long description of an image Specifies an image as a client-side image-map Deprecated. Use styles instead. Specifies the whitespace on top and bottom of an image Specifies the width of an image
Standard Attributes
The <img> tag supports the following standard attributes:
Description Specifies a classname for an element Specifies the text direction for the content in an element Specifies a unique id for an element Specifies a language code for the content in an element Specifies an inline style for an element Specifies extra information about an element Specifies a language code for the content in an element, in XHTML documents