Horje
HTML Images

HTML images are defined with the tag.

The source file ( src ), alternative text ( alt ), width , and height are provided as attributes:


Example of HTML Image Code

Images can improve the design and the appearance of a web page

index.html
Example: HTML
<img src="https://horje.com/avatar.png" alt="User" width="500" height="333">

Output should be:

Example of HTML Image Code

Definition HTML Images

HTML images refer to the use of the <img> tag in Hypertext Markup Language (HTML) to embed or link images within a web page. Unlike other elements that directly contain content, the <img> tag is a "void element," meaning it does not have a closing tag and primarily functions by referencing an external image file.

HTML Images Syntax

The HTML <img> tag is used to embed an image in a web page.

Images are not technically inserted into a web page; images are linked to web pages. The <img> tag creates a holding space for the referenced image.

The <img> tag is empty, it contains attributes only, and does not have a closing tag.

The <img> tag has two required attributes:

index.html
Example: HTML
<img src="url" alt="alternatetext">

Output should be:

HTML Images Syntax

The src Attribute of HTML Images

The required src attribute specifies the path (URL) to the image.

Note: When a web page loads, it is the browser, at that moment, that gets the image from a web server and inserts it into the page. Therefore, make sure that the image actually stays in the same spot in relation to the web page, otherwise your visitors will get a broken link icon. The broken link icon and the alt text are shown if the browser cannot find the image.

index.html
Example: HTML
<img src="img_chania.jpg" alt="Flowers in Chania">

Output should be:

The src Attribute of HTML Images





Related Articles
HTML Documents HTML Basic
HTML <!DOCTYPE> Declaration HTML Basic
HTML Headings HTML Basic
HTML Paragraphs HTML Basic
HTML Text Links HTML Basic
HTML Images HTML Basic
How to View HTML Source HTML Basic

Single Articles
Example of HTML Image Code HTML Basic
Definition HTML Images HTML Basic
HTML Images Syntax HTML Basic
The src Attribute of HTML Images HTML Basic

Category :
Web Tutorial
Sub Category :
HTML Basic
Uploaded by :
Admin


Read Article
https://horje.com/learn/1434/reference