WordPress.org

Support

Support » Themes and Templates » Media Sizes & Responsive Images

Media Sizes & Responsive Images

  • Hi,

    When building a responsive theme, I use the following snippet to make images responsive:

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

    Which works pretty good. But if I want an image to be say 600×400 and no bigger, but still shrink to fit on small screens, how can I do this? At the moment, when entering 600×400 into the image modal box on a page or post, those figures are ignored and the image is stretched to fit it’s container (as expected).

    Thanks

Viewing 1 replies (of 1 total)
  • Could you change max-width: 100%; to

    max-width: 600px;
    max-height: 400px;

    If you don’t want that applied to all images, you could create a special image class for it, and give the needed images that class under Advanced settings.

Viewing 1 replies (of 1 total)
  • The topic ‘Media Sizes & Responsive Images’ is closed to new replies.
Skip to toolbar