View Full Version : Resolved image size depending on browser width or screen resolution?

10-26-2009, 04:06 PM

Is it possible to set an image size or images by the size of the user screen resolution/browser width ?

10-26-2009, 04:13 PM
You may carefully use width and height in style/CSS with values having % units, provided its container element should be a block level element and should not have any fixed dimension applied to it.

10-26-2009, 04:35 PM
If you are actually wanting to scale the images according to the browser size then as abduraooft says. using percentages is the only real way to go with css. Or of course you could look at doing it with javascript which should be pretty straight forward although not as accessable / compliant as css.
If you are actually wanting to scale the visible area of the image without effecting the actual image dimensions then I would recommend putting the images as backgrounds.

A div should automatically fill the available width provided it is not floating or absolutely positioned so if you give the div a defined height either using percentages or pixels, the width will scale as required. then rather than using a defined width and height on the actual image, just put the image as a center aligned background for the div.

10-26-2009, 05:38 PM
Thanks Guys :D

I haven't put it in CSS yet but it will be, just playing around with it in the img html tag with the width and height.

It will be in the CSS file by the time I have finish so that may give me a bit more flexability a long with if I use div and background it.

Also hoping to get rid of the tables and turn to div, may make a post about that in a few days.

Thanks again :)