
- Making media queries for mac laptop retina display how to#
- Making media queries for mac laptop retina display archive#
- Making media queries for mac laptop retina display download#
When you don’t want to make major changes in the HTML markup. Or you want to use the latest image formats like webp or avif on a supported device. When you want to load an entirely different image based on screen size i.e. For e.g., a three-column layout on desktop vs a two-column layout on the mobile device. When the layout & image size changes based on the viewport width. Let’s have a quick comparison before discussing each of these techniques in more details:įor fixed-size images that take roughly whole viewport width, e.g., full-width promotional banner.įor flexible images. In this chapter, we will cover the latest methods for implementing responsive images. We have come a long way from using hacky javascript based solutions to having native support in modern browsers. There are many methods for implementing responsive images.
Making media queries for mac laptop retina display how to#
Chapter 3 - How to make images responsive? This is a wastage of time, bandwidth, and money and degrades the overall user experience.
Making media queries for mac laptop retina display download#
This means that the user on a mobile device with a small viewport width has to download that extra data, which slows down the page load. Without a means to do this, you will have to send an overly large image to all users. Ideally, you would like to serve images that are resized to match the user’s viewport dimensions. With mobile traffic surpassing desktop traffic, it has become even more crucial to optimize images for different device sizes.
Making media queries for mac laptop retina display archive#
Faster loading web pagesĪccording to the HTTP archive data, 64% of a website’s page weight, on an average, is made up of images. You can also use this to show different images in a mobile device based on orientation - landscape vs portrait mode. We will cover this technique in more detail soon. By "art directing", you can explicitly decide which image should be shown based on the image's size on the page. It is highlighting different elements of the user interface to a potential user. The most important part might get cropped.įor example, consider this screenshot of a dashboard on a product landing page. When a large image is resized to fit a small area, it can lose its relevance, usefulness, and legibility. Despite being similar in terms of file-size, the 2x image will give a sharper appearance. On a device, with DPR (device pixel ratio) 2, a 2x wide image with low-quality (50) will look better than a 1x wide image with high-quality(90). However, note that it does not always mean that we have to load a large file size. It means if we want to render a 100 CSS pixels wide image, we will have to load a 200px wide image for it to look sharp.įor a device with pixel density 3, we will have to load a 300px wide image. Effective device resolution: 750px by 1334px.In simple terms, a large image is required to fit the same physical image. As a result, high-resolution displays demand images with more pixels. This means more pixels in the same amount of physical space. High-resolution displays have a higher pixel density. If the browser stretches a smaller image to fit the design, the rendered image will look blurred, and if you load a bigger image on a device with small viewport width, it results in bandwidth and time wastage.

If your layout changes based on the device viewport, the loaded image dimension should match the container CSS/HTML width. This is especially important on retail sites where users expect to view high-resolution closeups of product images to better look at texture & details.įor an image to look good, it must adapt based on viewport width and screen pixel density. Render a high-quality image on different devicesĪn image without perceptible artifacts looks crisp and contributes towards a great user experience.

Here are three main reasons why we need to implement responsive images: A responsive design should adapt based on user screen size, pixel density, and device orientation to ensure a great user experience. Chapter 2 - Why do we need responsive images?Īs you saw in the above example, one size doesn’t fit all.

As of Oct 2020, all browsers support srcset except Opera mini and IE. Note that we are still using the old src attribute as a fallback if the browser doesn’t support the srcset attribute. We will soon discover more about srcset and other options in great detail. The browser picked the right option based on the actual viewport size of the device. We used srcset (source set) to provide the browser with three different size images. This is a simplified version of responsive images in action.
