Logo Code X Community

Lesson 5: Working with Images and the <link> Tag

1. The <img> Tag

The <img> tag is used to display images in HTML. It is a self-closing tag.

Common Attributes of <img>:

Example:

<img src="img/sample.jpg" alt="A sample image" width="300" height="200" title="Sample Image" loading="lazy">

2. The <link> Tag

The <link> tag is mainly used in the <head> section to link external resources such as stylesheets or icons.

Common Attributes of <link>:

Example:

<link rel="stylesheet" href="style.css" type="text/css">
<link rel="icon" href="img/logo.png" type="image/png">