How To Insert Images In An HTML document

Only textual information makes a web page damn boring. Of course, the web is not just about text, it is multi-media and the most common form of media is the image. The img tag is used to put an image in an HTML document and it looks like this:
<img src="" width="157"height="70" alt="logo" />

The src attribute tells the browser where to find the image. Like For example, if you create your own image and save it as 'image1.jpg' in a directory called 'images' then the code would be <img src="images/image1.jpg"...

  • 1. The width and height attributes are usually required.
  • 2. The alt attribute is the alternative description. This is used for people who cannot or choose not to view images. This is a requirement in the latest versions of HTML.
  • 3. the img tag does not have a closing tag, it closes itself, ending with />

Note: The construction of images for the web is a little outside of the remit of this website, but it is worth noting a few things.

  • 1. The most commonly used file formats used for images are GIFs and JPEGs. They are both compressed formats, and have very different uses.

  • 2. GIFs can have no more than 256 colours, but they maintain the colours of the original image. The lower the number of colors you havein the image, the lower the file size will be.

  • 3. GIFS SHOULD BE USED FOR IMAGES WITH SOLID COLOURS. JPEGs on the other hand use a mathematical algorithm to compress the image and will distort the original slightly. The lower the compression, the higher the file size, but the clearer the image.

  • 4. JPEGS SHOULD BE USED FOR IMAGES SUCH AS PHOTOGRAPHS. Images are perhaps the largest files a new web designer will be handling. It is a common mistake to be oblivious to the file size of images, which can be extremely large. Web pages should download as quickly as possible, and if you keep in mind that most people use modems that download at less than 7Kb a second (realistically it is less than 5Kb), you can see how a large file will greatly slow down the download time of a full page.

  • 5. You need to strike a balance between image quality and image size. Most modern image manipulation programs allow you to compress images and the best way to figure out what is best suited for yourself is trial and error.

<img src="1.jpeg" width="100" height="100"/>

Result to the above code

Guys follow the various other tutorials to catch on further in html coding and designing!!!