To place an image on a page, use the <img>
tag. The <img>
tag has no closing tag.
img
tagWe can specify the image from a source on another server using an absolute link, or from our own using a relative link.
<img src="http://www.w3.org/html/logo/downloads/HTML5_Logo_512.png" alt="HTML 5 Logo" width="200px">
Or relative:
<img src="/code/img/main-logo.svg" alt="Code Snippets Academy logo">
There are several image formats, each with their advantages and disadvantages. It's important to understand the filesize and its quality, as a super-high resolution may take a lot longer to load on the page. If your users are impatient, they may navigate elsewhere!
JPEG is a lossy compression format that compresses the original image. The upside to JPEGs are a smaller file size, but the drawback is that the image becomes not as clear.
GIFs contain no more than 256 colors, thus lowering the file size. We can have some pixels in the GIF to be transparent.
With a PNG, we can have 16 million colors, as well as alpha transparency. Very high resolution, so high file size.
Scalable Vector Graphics (SVG) is an XML-based vector image format for 2d graphics. The great thing about these is no matter how large or small it gets, the image does not blur or lose quality.
Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.
$ Check priceThis book teaches HTML as if it's for anyone - hobbyists, students, and professionals - and it's full-color throughout. It utilizes information graphics and lifestyle photography to explain the topics in a simple way that is engaging. You can progress through the chapters from beginning to end or just dip into topics of particular interest at your leisure.
$ Check priceAd