Use img to embed image

Description

The img element allows you to embed an image into an HTML document.

It has local attributes:src, alt, height, width, usemap, ismap.

The border, longdesc, name, align, hspace, and vspace attributes are obsolete in HTML5.

Example

To embed an image, you need to use the src and alt attributes as follows.


<!DOCTYPE HTML>
<html>
<body>
  <img src="http://www.java2s.com/style/download.png" 
       alt="Triathlon Image" 
       width="200" 
       height="67" />
</body><!-- w ww  . ja v  a 2s.  co  m-->
</html>

Click to view the demo

Note

The src attribute specifies the URL for the image.

The alt attribute defines the content if the image cannot be displayed.

The width and height attributes set the image size (in pixels).





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed