SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict sdamos's Avatar
    Join Date
    Sep 2003
    Location
    Arizona
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Graphic Behavior in CSS

    If I have a 3 column layout that resizes the text and such to the page and res settings, is there a way to make CSS resize a graphic too? For example, if I have a page layout in CSS that is 775 pixels wide, and so is the graphic, what happens if the page is shrunk smaller than the width of the Graphic?

    Thanks,
    Shannon

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    This won't work in IE but it might in Moz/Opera so maybe it's worth a shot.
    HTML Code:
     <img src="/path/to/img.png" alt="" style="width: 775px; max-width: 100%;" />

  3. #3
    SitePoint Addict sdamos's Avatar
    Join Date
    Sep 2003
    Location
    Arizona
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    Quote Originally Posted by DJ P@CkMaN
    This won't work in IE but it might in Moz/Opera so maybe it's worth a shot.
    HTML Code:
     <img src="/path/to/img.png" alt="" style="width: 775px; max-width: 100%;" />
    Thanks, but I want it to work in IE mostly. Thinking of doing something different anyway, thx for the reply!

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,285
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Just take the size out of the image tag and set the size in % with css.
    Code:
    img {width:20%;height:8%}
    The image will then shrink and grow as required. Just try and set the apsect ratio as near to the original size as possible.

    Paul

  5. #5
    SitePoint Addict sdamos's Avatar
    Join Date
    Sep 2003
    Location
    Arizona
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks!

    Quote Originally Posted by sdamos
    Thanks, but I want it to work in IE mostly. Thinking of doing something different anyway, thx for the reply!
    Thanks!


Bookmarks

Posting Permissions

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