SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy setting an image to fit screen size

    I've got an image that's 800px wide.

    I want to make it so that it fits any screen width of the user.

    I've tried setting width at 100% but this just pulls the image and distorts it.

    How do I make it so the image fits the screen but doesn't distort?

    Many thanks

    liberatortoo

  2. #2
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by liberatortoo
    How do I make it so the image fits the screen but doesn't distort?
    If the actual size of your image is only 800px and you then view it on a 1024 res screen, then of course it's going to be stretched and distorted, particularly if it's a JPEG. The only way to prevent this is to make the physical size of the image larger than the highest screen resolution available so that at most sizes, the image is compressed, rather than expanded.
    Of course, this will probably mean an unfeasibly large image, so you may have to either not worry about people with higher res screens, or rethink what you're trying to do.


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
  •