Using a different image for a block dependent on screen size
-
I have a large image that I am quite emotionally attached to, which I use as my landing page headline image. Actually I am using Twenty Twenty and for various reasons it is much easier to place the image in a block on the page rather than try to set it as the page’s Featured Image.
Now I’m facing a problem that the image shrinks too much on mobiles and isn’t good. I’d like to show a cropped version of the image on mobiles and tablets.
I’ve searched and not found any plugin that will do this, so it looks like it’ll have to be CSS – but how would I specify the different images? I can only think of using background-image but then the HTML element would have no height. I figure this would be the best media query:
@media (max-width: 768px) { .my-image { something: ???; } } @media (min-width: 769px) and (max-width: 1024px) { .my-image { something: ???; } } @media (min-width: 1025px) { .my-image { something: ???; } }
The page I need help with: [log in to see the link]
- The topic ‘Using a different image for a block dependent on screen size’ is closed to new replies.