Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Attributes

0/1

HTML Paragraphs

0/1

HTML Formatting

0/1

HTML Comments

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML Symbols

0/1
Text lesson

Images in Folder

When your images are located in a sub-folder, it’s necessary to include the folder name in the src attribute.

Example

<img src=”/images/image.gif” alt=”image Icon” style=”width:128px;height:128px;”>

Images on Another Server

To link to an image hosted on a different server, you need to use a complete URL in the ‘src’ attribute, known as an absolute URL.

Example

<img src=”https://code7school.com/images/image.jpg” alt=”code7school”>

Important Information : Considerations for using external images: Such images may be protected by copyright, and using them without authorization could infringe on copyright laws. Moreover, you have no control over external images; they could be deleted or altered without notice.

Animated Images

HTML supports animated GIFs.

Example

<img src=”programming.gif” alt=”Computer Man” style=”width:48px;height:48px;”>

Image as a Link

For an image to act as a link, place the <img> tag within the <a> tag.

Example

<a href=”https://code7school.com/”>
  <img src=”image.gif” alt=”Tutorial” style=”width:42px;height:42px;”>
</a>

Image Floating

Utilize the CSS float property to position the image to the left or right of text.

Example

<p><img src=”smiley.gif” alt=”Smiley face” style=”float:right;width:42px;height:42px;”>
The image will float to the right of the text.</p>

<p><img src=”smiley.gif” alt=”Smiley face” style=”float:left;width:42px;height:42px;”>
The image will float to the left of the text.</p>

Chapter Summary

  • Employ the <img> tag in HTML to insert an image.
  • Utilize the ‘src‘ attribute in HTML to specify the image’s URL.
  • Apply the ‘alt‘ attribute in HTML to provide alternative text for the image in case it fails to display.
  • Set the dimensions of the image using the ‘width’ and ‘height’ attributes in HTML or the ‘width‘ and ‘height‘ properties in CSS.
  • To position the image to the left or right, use the ‘float‘ property in CSS.