pidabrow
pidabrow

Reputation: 976

amp-img and defining size in context of media size

I'm wondering if I can define size of the AMP image not only for two different width's but for example for three or even four:

<amp-img
    media="(min-width: 650px)"
    src="wide.jpg"
    width=466
    height=355 layout="responsive" ></amp-img>
<amp-img
    media="(max-width: 649px)"
    src="narrow.jpg"
    width=527
    height=193 layout="responsive" ></amp-img>

I tried to achieve it by parallel definiton of min-width and max-width but it doesn't seem to work. Is such a thing possible?

Upvotes: 0

Views: 102

Answers (1)

Andrew
Andrew

Reputation: 1203

Yes, it is possible, you can use the srcset attribute. More info can be found here.

Upvotes: 2

Related Questions