Images: Syntax

In HTML, images are defined with the <img> tag. The <img> tag is empty, containing attributes only, and does not have a closing tag. The src attribute specifies the URL (web address) of the image:

<img src="url" alt="some_text">
HTML file: Displayed by browser:
<!DOCTYPE html>
  <html>
    <body>

<h2>A Great School</h2>
<img src="images/w3schools.jpg" alt="W3Schools" style="width: 104 px; height: 142 px;">

    </body>
  </html>

A Great School

W3Schools

Good habit Always specify the width and height of an image. If width and height are not specified, the page will flicker while the image loads.
Back button Table of Contents Next button