HTML img Tag src Attribute Tutorial

In this section, we will learn what the src attribute is and how to use it.

What is src Attribute in HTML <img> Tag?

The src attribute in HTML <img> element is used to set the address of the target image.

Browsers then take this address and send a request to it to get back the target image and will load it on the page.

HTML src Attribute in <img> Tag Syntax:

<img src = “image URL”>

<img> Tag src Attribute Values

The value we set for this attribute could be any absolute or relative URL that refers to an image.

Example: using src attribute in HTML <img> tag

See the Pen using src attribute in HTML <img> tag by Omid Dehghan (@odehghan) on CodePen.

Leave a Reply