Important: How sizes is calculated: The automatic sizes calculation uses the display width of the image.This means that the width of the image has to be calculable at least approximately before the image itself is loaded (This means you can not use width: auto).Often the following general CSS rule might help: img[data-sizes="auto"] { display: block; width: 100%; } (see also contains methods that permit you to re-populate