/* ----------------------------------------------- Blogger Template Style Name: Minima Black Designer: Douglas Bowman URL: www.stopdesign.com Date: 26 Feb 2004 ----------------------------------------------- */ CompuDave: Images - And an Old Dog Learns a Trick

Wednesday, May 18, 2005

Images - And an Old Dog Learns a Trick

Google helps me find my problem with images.
When I post an image I often make the image fit by just using width="50%" and height="50%" inside the html img tag. Turns out to be wrong. When you use a percent insted of pixels as the values the browser makes the image a percent of your current window or frame.
I had always thought it worked just like it does for fonts and would just make it a percent of the original size. Never assume.

Normal size:
Me & Girls DL

and half size using half dimensions in then html tag

Me & Girls DL

Well clearly using pixels is the right way. Only problem there is you have to check the properties of the source image and do the math. Well at least I'm pretty good at math.

A trick that is suppose to work is using only a percent in one dimension - this is suppose to keep the aspect ratio (which it seems to), but they are not 50% in size, they are still 50% if the column width.

and one more using just a percent width only

Me & Girls DL

and one more using just a percent height only

Me & Girls DL

tags:

0 Comments:

Post a Comment

<< Home