Skip to content

<picture> vs img srcset #48

Answered by codingjoe
strom-und-spiele asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @strom-und-spiele,

First, thanks for your kind words. They mean a lot.

I'll start with a little deep dive into a responsive image-serving, to better explain my decision making later on.

You are right, the srcset attribute is meant to serve images of different sizes / resolution, depending on the viewport via the sizes. Both must actually be present and they alone do what you describe as size control and art direction.

All of this doesn't require using the picture tag. That only comes in handy if you want to serve different sources, as in, different file types. If you are OK only serving WebP, we could add a template tag, that renders as an image tag. But if you want to serve IE or rece…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@strom-und-spiele
Comment options

@codingjoe
Comment options

Answer selected by strom-und-spiele
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants