Loading tutorials
<img src="photo.jpg"> works everywhere, but it can't fit every screen. A phone on a mobile connection and a 4K monitor on fiber have different needs. Whatever file you choose is wrong for one of them. This chapter explains why, and it sorts the problem into three separate causes. The late6 min readimg element on its own. Later chapters add srcset, sizes, and picture on top of it. You need to understand what img does first, because every responsive technique in this tutorial still ends in an img.6 min readimg element with its src and alt attributes, and basic CSS. It also assumes you know that a CSS pixel is not always one device pixel. You will learn how srcset with x descriptors lets the browser pick a sharper file on high-density screens, and where this 6 min readimg element with src and alt, and that you know the difference between CSS pixels and device pixels. It also assumes you have seen srcset with x descriptors. Here you will learn the w descriptor, which is the form you will use for most fluid layouts.5 min readimg element, CSS media queries and viewport units (vw), and the difference between CSS pixels and device pixels. It also assumes you have read the chapter on w descriptors in srcset.6 min readimg with src and alt, read a CSS media query, and use viewport units such as vw. It also assumes you know that one CSS pixel can be backed by several device pixels. The chapter explains how the browser turns srcset, sizes, and picture into one down5 min readimg, src, alt), basic CSS (media queries, max-width), and the difference between CSS pixels and device pixels. It also assumes you have read the earlier chapters on srcset and sizes. Here you will learn why the browser needs to know an image's sh6 min readpicture and its source children work, and in what order the browser evaluates them. It assumes you know the img element with src and alt, basic CSS media queries, and how srcset with w descriptors and sizes work. Later chapters build on this one to cover forma6 min readimg element, srcset with w descriptors, and sizes. It also assumes you know the common image formats (JPEG, PNG, WebP). The goal is to serve a modern, smaller format to browsers that can decode it, and to keep a JPEG for everyone else.5 min readimg element with src and alt, basic CSS media queries, and the difference between CSS pixels and device pixels. It also assumes you have seen srcset with x and w descriptors. Here you will learn how to use picture with media to serve different crops 7 min readsrcset with w descriptors, the sizes attribute, and the basic picture element with media and type. You should also be comfortable with CSS media queries and viewport units. Here you combine the three techniques in one element, and you will see where the comb6 min readsrcset points to. It assumes you can write srcset with w descriptors and a sizes attribute, and that you know the difference between CSS pixels and device pixels. You also need a terminal with ImageMagick 7 or Node.js 18 or later for the exam6 min readsrcset and sizes, and that you know why width and height attributes reserve space (covered in earlier chapters). It also assumes basic familiarity with the browser's network panel.6 min readsrcset, sizes, and picture. You know that the browser, not your code, picks the file. You also know the difference between CSS pixels and device pixels. This chapter is about verifying that choice. You will find out which file loaded, whether it was a sens5 min read