Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Question image size depending on browser width or screen resolution?

    Hi,

    Is it possible to set an image size or images by the size of the user screen resolution/browser width ?
    Last edited by Big-Gaz; 10-26-2009 at 05:38 PM.
    Thanks,
    Big-Gaz

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    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.
    Last edited by abduraooft; 10-26-2009 at 04:19 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Big-Gaz (10-26-2009)

  • #3
    New Coder
    Join Date
    Oct 2009
    Posts
    11
    Thanks
    2
    Thanked 1 Time in 1 Post
    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.

  • Users who have thanked sillyfishyboy for this post:

    Big-Gaz (10-26-2009)

  • #4
    New Coder
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thanks Guys

    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
    Thanks,
    Big-Gaz


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •