Core HTML

The Image Tag

The most basic non-text element is an image. Here, we display an image of "The Crucifixion" that was painted by Leon Bonnat. The src properety defines a URL for the image. The alt property defines text that is displayed when the image can not be displayed. For example, the URL might be incorrect. Notice that the <img> tag does not a start and an end tag; it only has one.

Above the image, we have an <h1> heading with <cite> tag enclosing the title of the painting as a citation.

Image.html

<!DOCTYPE html>
<html>
  <head>
    <title>XoaX.net's HTML: Image Tag Example</title>
  </head>
  <body>
    <h1><cite>The Crucifixion</cite></h1>
    <h2>by Leon Bonnat</h2>
    <img src="TheCrucifixion_LeonBonnat.png" alt="TheCrucifixion" />
  </body>
</html>
 

Output

 
 

© 2007–2024 XoaX.net LLC. All rights reserved.