Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Expanding Image

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44871
    ma701ss
    Member

    Hi,

    If you go to PayPal’s UK homepage there’s an image of a couple looking out onto a lake. This image is sized at 1600px so it fills the screen regardless of the screen resolution. How simply do I achieve this without having a left/right scroll bar at the bottom if the screen resolution is less than 1600px wide? As the screen resolution gets bigger more of the image at the sides will be seen, and as it gets smaller they will be cut off.

    Thanks

    #135572
    chrisburton
    Participant

    img {
    max-width: 100%;
    height: auto !important;
    }

    Demo: http://jsfiddle.net/kuQhK/embedded/result

    * resize the browser

    #135575
    ma701ss
    Member

    Thanks that works well. Sorry my CSS is rusty/developing. I tried adding “.home” after img so I can apply only to certian images using class=”home” but it didn’t work. What’s the correct syntax?

    #135576
    chrisburton
    Participant

    @ma701ss

    HTML

    CSS

    img.home {
    max-width: 100%;
    height: auto !important;
    }

    or

    .home {
    max-width: 100%;
    height: auto !important;
    }

    Although, I would do this for every image

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.