One thing I am struggling with is how to handle images on the smartphone. I am fine creating breakpoints and image styles for wide, normal and narrow. But below narrow, the smartphone can be a wide range of widths and clearly we don't want a breakpoint for each device. Also, since we move to a one column view, we can often use larger photos than for the narrow breakpoint. How do we make the image fluid below the narrow breakpoint so that it fills the width of the screen?

Comments

attiks’s picture

Use an image style big enough to cover the full width and use css to add width: auto; height: auto;

dmkelner’s picture

In my case the biggest image style is 500x180, which would be fine as a starting point for mobile. However, when I assign that to the mobile breakpoint in my picture group it is applied in the code. I'm not sure I understand how I can override this with my css. Thanks for your help!

attiks’s picture

use the biggest image style for your mobile breakpoint, inside your css add something like

@media all and (max-device-width:320px) {
  .field--picture img {
    max-width: 100%;
    height: auto;
  }
}

you probably have to add change the selector (.field--picture) to something else.

dmkelner’s picture

Beautiful. Thanks so much for the assistance and for the picture and breakpoint modules. So powerful once you get the hang of it.

attiks’s picture

Status: Active » Closed (works as designed)