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:
and half size using half dimensions in then html tag
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
and one more using just a percent height only
tags: HTML
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:
and half size using half dimensions in then html tag
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
and one more using just a percent height only
tags: HTML
0 Comments:
Post a Comment
<< Home