Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to Shrink image size when browser size is reduced

Reply
Thread Tools

How to Shrink image size when browser size is reduced

 
 
Bob Richardson
Guest
Posts: n/a
 
      03-07-2005
Is it possible for an image to SHRINK (both height and width, keeping same
h/w ratio) when the browser's width is reduced? It's easy to have both h & w
increase, as needed, to fill up 100% of the <td>, but I don't see how to
have the image shrink.

Without JavaScript, the standard seems to be scrollbars when the browser
shrinks. I'd like the picture to shrink in size and avoid the scrollbars.


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      03-07-2005
Bob Richardson wrote:

> Is it possible for an image to SHRINK (both height and width, keeping same
> h/w ratio) when the browser's width is reduced? It's easy to have both h & w
> increase, as needed, to fill up 100% of the <td>, but I don't see how to
> have the image shrink.


Percentages my friend, percentages.

> Without JavaScript, the standard seems to be scrollbars when the browser
> shrinks.


Only for those that know no better, and that may indeed include me.

> I'd like the picture to shrink in size and avoid the scrollbars.


And what exactly does this have to do with Javascript?

<img src="someImage.gif" width="100%">

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
 
Reply With Quote
 
 
 
 
Bob Richardson
Guest
Posts: n/a
 
      03-08-2005

"Randy Webb" <> wrote in message
news:k9idnUZeUP3DfbHfRVn-...
> Bob Richardson wrote:
>
>> Is it possible for an image to SHRINK (both height and width, keeping
>> same
>> h/w ratio) when the browser's width is reduced? It's easy to have both h
>> & w
>> increase, as needed, to fill up 100% of the <td>, but I don't see how to
>> have the image shrink.

>
> Percentages my friend, percentages.
>
>> Without JavaScript, the standard seems to be scrollbars when the browser
>> shrinks.

>
> Only for those that know no better, and that may indeed include me.
>
>> I'd like the picture to shrink in size and avoid the scrollbars.

>
> And what exactly does this have to do with Javascript?
>
> <img src="someImage.gif" width="100%">


The above is exactly how I've coded the HTML. I think the IMG is 700 pixels
wide. When you expand the size of your browser beyond 700, the picture's
width and height both expand. But when the browser's width is less than 700,
the picture does not shrink. Just scroll bars.

Thus, I thought that perhaps a JavaScript function might work to reduce the
size of the image.


 
Reply With Quote
 
Bob Richardson
Guest
Posts: n/a
 
      03-08-2005

"Bob Richardson" <bobr at whidbey dot com> wrote in message
news:FsKdndc44e_o27DfRVn-...
>
> "Randy Webb" <> wrote in message
> news:k9idnUZeUP3DfbHfRVn-...
>> Bob Richardson wrote:
>>
>>> Is it possible for an image to SHRINK (both height and width, keeping
>>> same
>>> h/w ratio) when the browser's width is reduced? It's easy to have both h
>>> & w
>>> increase, as needed, to fill up 100% of the <td>, but I don't see how to
>>> have the image shrink.

>>
>> Percentages my friend, percentages.
>>
>>> Without JavaScript, the standard seems to be scrollbars when the browser
>>> shrinks.

>>
>> Only for those that know no better, and that may indeed include me.
>>
>>> I'd like the picture to shrink in size and avoid the scrollbars.

>>
>> And what exactly does this have to do with Javascript?
>>
>> <img src="someImage.gif" width="100%">

>
> The above is exactly how I've coded the HTML. I think the IMG is 700
> pixels wide. When you expand the size of your browser beyond 700, the
> picture's width and height both expand. But when the browser's width is
> less than 700, the picture does not shrink. Just scroll bars.
>
> Thus, I thought that perhaps a JavaScript function might work to reduce
> the size of the image.


Ah, I see that it shrinks nicely in Firefox, but not IE 6


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Help! Fixed width table with a 100% width image in it is assuming theimages intrinsic size, although it does shrink the image satya.komatineni@gmail.com HTML 1 12-29-2007 08:32 PM
DVD Shrink: After Shrink to Hard drive, what's NEXT? hiddenat@lycos.com DVD Video 11 09-21-2004 01:41 AM
DVD Shrink: After Shrink to Hard drive, what's NEXT? Thanks!!!!!! hiddenat@lycos.com DVD Video 2 09-09-2004 11:45 PM
ViewState Size Reduced, but not Completely Empty Jeff S ASP .Net 1 01-20-2004 01:55 AM



Advertisments