When your images are located in a sub-folder, it’s necessary to include the folder name in the src attribute.
<img src=”/images/image.gif” alt=”image Icon” style=”width:128px;height:128px;”> |
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.
<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.
<img src=”programming.gif” alt=”Computer Man” style=”width:48px;height:48px;”> |
For an image to act as a link, place the <img> tag within the <a> tag.
<a href=”https://code7school.com/”> |
Utilize the CSS float property to position the image to the left or right of text.
<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> |
<img>
tag in HTML to insert an image.