Image size in CSS?

Sharky Forums


Results 1 to 2 of 2

Thread: Image size in CSS?

  1. #1
    Sushi the_man_stephen's Avatar
    Join Date
    Apr 2002
    Posts
    2

    Question Image size in CSS?

    is there a way to set maximum pixel width of an image in a css style document?

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077
    Exactly what behavoir are you trying to accomplish? Are you trying to have an image displayed at actual size and proportions, BUT, if the image is larger than "x" pixels wide, than you would like the image scaled down?

    There's currently no way to do this with CSS. I've done this in quite a few web site's with Server-side languages such as Cold Fusion and PHP. Basically, you have to write a script to read the image's file headers directly from the file system on the web server to determine what the actual width & height of the image is. You can then do some proportion calculations to resize the image as necessary.

Posting Permissions

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