Embedded Content
Embedded Content
Inserting Graphics
The Web page becomes more interesting if pictures are added. Graphics
enhance the appearance of your Web page. You can place small or large images.
You can even use an image as a link to other pages.
To insert a graphics file, you have to create inline images. This can be done
by identifying the URL reference. You have to identify exactly where image can
be found; otherwise, it will not be displayed on the Web page. Graphics should
be GIF, JPG, BMP or PNG files.
File Format Application
GIF Line art and animation
JPEG Photographic
BMP Most common graphics
used in Web pages and
made up of pixels
PNG Line art and photographs
The easiest place to save the image is in the same folder or directory as your
HTML source file, where the browser will automatically search. If you have
many images to organize, you may want to place them in a single folder. You
can name this folder as image or pictures. Then place that folder in the same
directory as your HTML file.
You have to use the IMG (image) format tag when inserting a graphics file.
The IMG tag has several attributes. The primary attribute is the
src=graphicsname. SRC means source and refers to the location of the image.
You should be careful with the way you write the filename. Filenames are
case sensitive. If the filename is in capital letters, then the attribute must
also be in capital letters inside quotation marks. If it is in small letters, then
the attribute should also be in small letters.
Name Tag Function Syntax
Image tag Inserts images under <img src =
the same folder “image_URL”>
<img src = “filename”>
Inserts images in a <img src –
separate folder and “picture/filename”>
includes the exact
location of the file.
To insert a picture
1. Open Notepad
2. Type the following:
<html>
<head><title>Inserting Picture</title></head>
<body>
<img src="C:\Users\lealynn\Desktop\Staysafe.jpg">
</body>
</html>
3. Save it as image1.html
To align the text to the Top, Bottom and Middle of the image.
(You can use any picture or graphics available in your computer.)
1. Open Notepad.
2. Type the following:
<html>
<head><title>Image Position</title></head>
<body>
<img align="top" src="C:\Users\lealynn\Desktop\Computer.jpg">
This text is aligned at the TOP of the image.
<br>
<br>
<img align="middle"
src="C:\Users\lealynn\Desktop\Computer.jpg">
This text is aligned at the MIDDLE of the image.
<br>
<br>
<img align="bottom"
src="C:\Users\lealynn\Desktop\Computer.jpg">
This text is aligned at the BOTTOM of the image.
<br>
<br>
</body>
</html>
3. Save it as image2.html
</body>
</html>
3. Save it as image3.html
Identifying the size makes the Web page display faster. If there are size hints
for your inline images, the browser can display the formatted HTML document.
If size hints are not used, the user will see a small icon in place of the image.
It can resort to a distortion on the way the Web page was formatted.
The height and width of the image is measured in pixels. Use the <img>
tag’s HEIGHT attribute to tell the browser how many pixels tall the graphic
display is. Use the WIDTH attribute to tell the browser how many pixels wide the
graphic display is.
Syntax:
<img src=”filename” width=”value” height=”value”>
To add width and height to an image
1. Open Notepad
2. Type the following:
<html>
<head>
<title>Graphics4</title>
</head>
<body>
<font size = “4” color = “green”>
IMAGE WIDTH = 100 and HEIGHT = 100
<img src="C:\Users\user9\Desktop\SocialDistancing.jpg" width="100"
height="100">
</body>
</html>
3. Save it as Graphics4.html
You can determine the exact width and height of an image by using a
computer graphics program such as Adobe Photoshop. Open the image file
in a graphics program to determine its exact width and height. You can
easily reduce or enlarge the image by changing ethe values of the width and
height.
</body>
</html>
3. Save it as Image5.html
Aligning Image
The placement of the image on the page can be controlled by using the
image Align tag. Here are the different attributes of alignments.
Attribute Function
left or right Aligns to the side and wraps the text above, around
and below it.
top Aligns with the tallest item available
text top Aligns with the tallest text character available
middle Aligns the baseline of the current line with the middle
of the image
absmiddle Aligns the middle of the current line with the middle of
the image
baseline Aligns the bottom of the image with the baseline of the
current line
bottom Aligns the bottom of the image with the baseline of the
current line
absbottom Aligns the bottom of the image with the bottom of the
current line
Syntax:
<img src=”name of image” align=”type of alignment”>
To display the image on the left side
1. Open Notepad
2. Type the following:
<html>
<head>
<title>Image Alignment</title>
</head>
<body>
<img src="C:\Users\user9\Desktop\cat.png" align="left" width="100"
height="100">
<font size=”5” color=”blue” face=”Times New Roman”>
Cat on the Left side
</body>
</html>
3. Save it as Image6.html