Using Media Query with different images for different resolutions, which images will be requested?

Asked

Viewed 32 times

0

When I use different images with media query, the user’s browser will use which option?

  • Order all images from the site and use the appropriate one (making loading slower).
  • Request only the specific media query image (making loading faster).

An example of code below.

.container {
  background-image: url('imagem-menor.jpg');
}


@media only screen and (max-width: 400px) {
  .container {
    background-image: url('imagem-maior.jpg');
  }
}
  • the browser engine will render the page according to the CSS, that is, it will load the image that is in the media query corresponding to the resolution

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.