The address for this web page is:   http://www.onemathematicalcat.org/day_14_resizing_images.htm
On to the next lesson!
Back to the COURSE SYLLABUS

14. RESIZING IMAGES

(How do you like the "flashing border" on the table? Yet another example of the neat stuff that you can do with JavaScript!)

INDEX CARD #14:

RESIZING IMAGES (14a)

The WIDTH and HEIGHT attributes in the <IMG> tag indicate the dimension of the image, in pixels.
By specifying image width and height, the browser can "leave space" for the image as it lays out the page; the graphic is put in place when it arrives. (You can get the "natural" width and height of an image from any graphics editor; try something like "image properties.") Without width and height values, the page must be re-displayed when the graphics finally arrive.
If the width and height attributes differ from the actual image dimensions, the browser will resize the graphic. Image quality may not be very good; better to resize images in a graphics program.
<IMG SRC="tigger.gif"> width×height = 64×50

<IMG SRC="tigger.gif" WIDTH=128 HEIGHT=50>

Using an "EMPTY" Image for Spacing (14b)

You can achieve special effects by taking an "empty" graphic—1 pixel by 1 pixel, with no content—and re-sizing it as desired.
VIEW the source code for this page to see that (almost) "invisible space" in the amounts of 20, 15, 10, and 5 pixels has been inserted between the following horizontal rules:




This word and this word have 25 pixels of (almost) "invisible space" inserted between them.

NOTE: If the image is the same color as the background, or if it is transparent, then it won't show. Here, I wanted you to see the (almost) "invisible space."

Printable version of Index Card 14a

Printable version of Index Card 14b

WORKSHEET #14:

ASSIGNMENT #14:

On to the next lesson!
Back to the COURSE SYLLABUS
© 2000 Carol J.V. Fisher    All Rights Reserved