Basic TagImage SizeBorderTransparencyAlignment


The Most Basic Image Tag

To call up an image on a webpage or in e-mail, the form is this:

<img src="http://www.geocities.com/ResearchTriangle/8795/33.jpg">

The result of this particular tag is this:

To simplify things (and save on typing), I'm going to use "URL" instead of writing out the whole name and location of this image for the rest of these examples.


Image Size

You can specify height and width of an image to change its appearance on the page. If you don't use the height or width options, the image will appear its natural size, as it was originally created.

When specifying either height or width alone, the image will be scaled automatically to its original proportions. Here are two examples, with width set to 30 and 100 pixels, respectively, without specifying height:

<img src="URL" width=30>

<img src="URL" width=100>

If you specify both height and width, you may easily get a distorted image. Here's the square image with height at 30 and width at 250: <img src="URL" height=30 width=250>

The width option can also be expressed as a percentage of screen width, from 1 to 100%. Using 100%, you can use an image to make a horizontal rule from any image:

<img src="URL" height=6 width=100%>


Border

You can add a border around the image, with the border parameter, like this:

<img src="URL" border=8>

which looks like this:


Transparency

Make the image transparent, by setting the transparency parameter to any value from 1 to 100%:

<img src="URL" transparency=50%>

which looks like this (0%, 50%, 75%):


Alignment with Text

By setting an align attribute, you can place text next to an image, or even between images. If you place an image with an align=left attribute just before your text, the text will begin at the top right of the image, and run alongside it, eventually running beneath it.

<img src="URL" height=30 width=50% align=left>Here's some meaningless sample text to demonstrate what happens with left image alignment.

Here's some meaningless sample text to demonstrate what happens with left image alignment.

The following is an example of the align=right attribute:

<img src="URL" height=30 width=50% align=right>When you use right image alignment, you cause the text to run automatically to the left of the image, until it eventually runs beneath it.

When you use right image alignment, you cause the text to run automatically to the left of the image, until it eventually runs beneath it.

You can use images on both left and right, and run the text between the two images:

<img src="URL" height=30 width=25% align=left><img src="URL" height=45 width=40% align=right>Here's what happens when you put an image in twice (you could certainly use different images, or even different sized versions of the same one, as in this example).

Here's what happens when you put an image in twice (you could certainly use different images, or even different sized versions of the same one, as in this example).


...is brought to you by...

get your free homepage today