Home Forums WordPress Themes WhiteBlack WP Theme Flexslider Portrait Landscape Image Sizing

Flexslider Portrait Landscape Image Sizing

  • Author
    Posts
  • #5211

    hawkandco
    Participant

    Hello,

    I’m using the flexslider image gallery in my posts. And I have both portrait and landscape photos to insert into the gallery. I noticed that the portrait photos automatically get stretched to fit the container. So to preserve the image aspect ratio I changed the following CSS:

    .flexslider .slides img{
    width:auto !important;
    margin: 0 auto !important;
    }

    However, on a mobile device, the images fail to scale responsively and gets cut off. Is there any way to modify the CSS so that the flexslider container itself doesn’t just scale responsively in the horizontal direction but also in the vertical direction? And to have the images within scale proportionally and responsively as well?

    Thank you so much for your help!!

    Attachments:
    You must be logged in to view attached files.
    #5218

    Marcin
    Moderator

    Hi,

    try use max-width: 100%; and do not use width: auto; because it makes image with original width.
    You can check w3school article about it: http://www.w3schools.com/css/css_rwd_images.asp.

    regards, Marcin

    #5264

    DouglasSl
    Participant
    This reply has been marked as private.

You must be logged in to reply to this topic. Click here to login or register