LESSON 3.3 Preparing The Image or Graphics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Preparing the Image or

Graphics
The HTML <img> tag is used to embed an image in a web page.
The <img> tag creates a holding space for the referenced image.
The <img> tag is empty, it contains attributes only, and does not
have a closing tag.
TYPES OF IMAGE FILE EXTENSION
1. GIF (Graphic Interchange Format) is the file type for vector graphics,
simple images created like cartoons, that can contain up to 256 colors.
They are usually used for bullets, buttons, accents, fancy lines and images
featuring text . GIF images may have transparent areas, so that they do
not obscure the background image or color of the page. An added bonus
with GIF images is that they can be animated, like the globe below.
FOUR TYPES OF IMAGES
2. JPG or JPEG files (Joint Photographic Experts Group) are
commonly used for photo-realistic pictures containing thousands or
millions of colors. JPEG pictures are useful because you can control the
file size by altering the compression. The higher the file compression you
set the lower the image quality will be, and as a result the file size is
decreased.
FOUR TYPES OF IMAGES
3. PNG (Portable Network Graphics) is a new format used as an
alternative to GIF that supports transparency for pictures containing
thousands or millions of colors.
FOUR TYPES OF IMAGES
4. BMP files (Bitmap) can be used, but they are not recommended. They
are much larger than JPG or GIF files as they are not compressed, so will
take longer to download.
Inserting Graphics into a Web Page
You can insert a picture in your Web page through the empty tag <img>. And,
this has two required attributes:

• The src Attribute

The required src attribute specifies the path (URL) to the image.

Note: When a web page loads; it is the browser, at that moment, that gets the image from a
web server and inserts it into the page. Therefore, make sure that the image actually stays in
the same spot in relation to the web page, otherwise your visitors will get a broken link icon.
The broken link icon and the alt text are shown if the browser cannot find the image.
•The alt Attribute

The required alt attribute provides an alternate text for an image, if the user for
some reason cannot view it (because of slow connection, an error in the src
attribute, or if the user uses a screen reader).

•Image Size - Width and Height

You can use the style attribute to specify the width and height of an image.

Alternatively, you can use the width and height attributes. The width and height

attributes always define the width and height of the image in pixels.
Specifying the Background Image of a
Page
You can specify the background image of the page by using the
background Attribute inside the body tag <body
background=”value”>…</body>.
Note: Animated GIF inserting to HTML is similar to image inserting. For example, you
can insert animated GIF to HTML with IMG tag: <img src="animation1. gif">.
Activity #5

You might also like