In the following example, we insert a tulip photo w3my engineers in Shanghai Flower Port shooting in the page:
src="/i/eg_tulip.jpg"alt="上海鲜花港 - 郁金香" />
The effect of the above code:
(You can find more examples at the bottom of the page)
All browsers support the <img> tag.
img element is embedded in an image to your pages.
Please note that, technically, <img> tag does not insert an image in a Web page, but links from the image. <Img> tag to create an image that is referenced footprint.
Further reading: how to properly use the image
In HTML, <img> tag has no end tag.
In XHTML, <img> tag must be closed properly.
In HTML 4.01, it is not recommended to use image element "align", "border", "hspace" and "vspace" attribute.
In XHTML 1.0 Strict DTD not supported image element "align", "border", "hspace" and "vspace" attribute.
|alt||text||Provisions alternate text of the image.|
|src||URL||Predetermined display URL of the image.|
|align||Not recommended. According to the provisions of how to arrange text around the image.|
|border||pixels||Not recommended. Custom border around the image.|
|height||Define the height of the image.|
|hspace||pixels||Not recommended. Blank define the image left and right.|
|ismap||URL||The image is defined as a server-side image maps.|
|longdesc||URL||URL to the image that contains a long description of the document.|
|usemap||URL||The image is defined as a client-side image maps.|
|vspace||pixels||Not recommended. Define the image top and bottom of the blank.|
|width||Set the width of the image.|
<img> tag supports HTML in the global properties .
<img> tag supports HTML in the event properties .
HTML and XHTML One of the most striking features is the ability to include in the text of the document image, the image as either intrinsic objects (inline image) of the document, also can use it as a hyperlink can be downloaded separately document, or as a background document.
Reasonably be added in the document image content (static or animated icons, photographs, descriptions, painting, etc.), the document will become more lively, more attractive, and looks more professional, more information nature and easy to navigate. You can also make a special visual image becomes a hyperlink boot FIG.
However, if the excessive use of images, documents will become fragmented, chaotic, and can not read, users download and view the page, but will add a lot of unnecessary waiting time.
Please read the following article to learn two major image formats on the Web: GIF and JPEG, as well as how to properly use the image:
HTML DOM Reference Manual: Image Object