Inserting Images through img Tag

1.1 Introduction

The ‹img› tag is used to insert an image into an HTML document. The image itself isn’t being inserted directly into the document, the browser loads it from the source specified in the ‹img› tag.

There is an attribute required for ‹img› element: src, which is used to show the image source. The ‹img› is an empty element, which means that the closing tag isn’t required. HTML image path define/declare inside ‹img› tag.

1.2 Syntax

‹img src="imagepath/imagename">

‹img src="https://www.vlab.co.in/images/logo.jpg"›

1.3 Attributes of ‹img› tag

Attribute Value Description
alt text Specifies an alternate text for an image
border pixels Specifies the width of the border around an image
height pixels Specifies the height of an image
src URL Specifies the URL of an image
width pixels Specifies the width of an image