Sent by David Hucklesby on 8 December 2004 06:06
On Mon, 6 Dec 2004 13:48:25 -0600 Ron Pringle replied to Jon Stephenson:
>> Can I use a div to force a image to fit on a screen?
>>
> Yes, you can assign height and width values of 100% to it and it
> will scale to fit the screen (or its maximum dimensions, whichever
> comes first). For instance:
>
> img {
> border: none;
> height: 100%;
> width: 100%;
> }
>
Try dimensioning img width alone here and it should work, leaving the
height off of the CSS and giving no width and height attributes on
the <img> tag in the HTML. No need for an enclosing <div>.
The image will then stay proportioned.
For an example, see the photo here and change the window size:
<http://www.hucklesby.com/blog0410.shtml#day28>
CSS is at <http://www.hucklesby.com/blogstyle.css>
Note that it will grow to 100% of whatever the window size,
so make the image big enough. Enlarged images can look
terrible.
Life. Love. Peace.
David
--
David Hucklesby, on 12/7/2004
<http://www.hucklesby.com/>
--
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/