- In HTML we use IMG tags to insert images, commonly used in the Web three kinds: JPEG, png,gif.
In simple terms, JPEG is suitable for photos and complex images, while PNG or GIF is suitable for monochrome images, logos, and geometries.
- JPEG: Suitable for continuous-tone images, such as photographs, can represent 16 million different color images; "lossy" format, which loses information when compressed, does not support transparency and animation; The file is small.
- PNG: Suitable for monochrome images and lines composed of images, such as logo, clip art, small text in the image, can represent millions of colors, PNG has three kinds, PNG-8, PNG-24, PNG-32; "Lossless format", compression without loss of information, allow "Transparent", file is larger than JPEG, The number of colors to use, as compared to GIF.
- GIF: Similar to PNG, suitable for monochrome images and lines of images, such as logo, clip art, small text in the image, can represent up to 256 colors, "lossless" format; only one color is allowed to be set to "transparent"; the file is larger than JPEG, and animation is supported.
2.
The element is an inline element, the SRC attribute specifies the location of the image file, and the ALT attribute is a meaningful description of the image.
3. If you place a transparent image on a Web page, make sure that the mask color of the graphic matches the background color of the Web page.
Head first HTML and css-to add images to your page