You are on page 1of 2

Adding Images to a Web Page

The format of the IMG tag is as follows;


<IMG SRC=my picure name>
You dont need an end IMG tag. To put our Elvis picture into a web page we would enter
in the following HTML into Textedit
<HTML>
<HEAD>
<TITLE>Using Images in HTML</TITLE>
</HEAD>
<BODY>
Elvis is alive and here is the proof...
<p>
<IMG SRC="elvislives.jpg">
</BODY>
</HTML>

Copy this into textedit and save it as UsingImages.html. Remember to save it in your
MyHTMLDocuments folder. If you do everything right it should look as follows:

Adding Images to a Web Page


You can align an image in your document by using the ALIGN attribute of the IMG tag.
The valid directions for the align attribute are top, middle or bottom. You can also adjust
a pictures size by using the HEIGHT and WIDTH attributes. Finally,
Here is an example that uses all of these attributes..
Copy the following into Textedit and save it as UsingImages2.html.
<HTML>
<HEAD>
<TITLE>Using Images in HTML</TITLE>
</HEAD>
<BODY>
This text is aligned on the bottom...
<IMG SRC="elvislives.jpg" ALIGN=BOTTOM>
<BR>
This text is aligned on the top...
<IMG SRC="elvislives.jpg" ALIGN=TOP>
<BR>
This makes Elvis smaller
<IMG SRC="elvislives.jpg" WIDTH=30 HEIGHT=40>
</BODY>
</HTML>
It should look like the following..

You might also like