Media Sizes & Responsive Images (2 posts)

  1. welshhuw
    Posted 2 years ago #


    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 600x400 and no bigger, but still shrink to fit on small screens, how can I do this? At the moment, when entering 600x400 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).


  2. Odai Athamneh
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic