The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Issue with images on a website Reply To: Issue with images on a website


The problem isn’t coming necessarily from the CSS, but from the inconsistencies in the HTML-markup. That is to say, some images (also known as “responsive images”) have values for srcset– and sizes-attributes, others have not; making them behave differently on different brower-window-widths.

Probably since WordPress implemented reponsive images in core last year on images which are uploaded with the admin image uploader, and/or with are “featured”.

Responsive images is a background feature, meaning everything happens automatically whenever a user uploads an image in WordPress through the media uploader. When an image appears on a page, it will have `srcset` and `sizes` attributes as a result of that background process.

First thing I try solving this issue would be either not to use the image-uploader for these images thumbnails in this image gallery, because these small images don’t need the different sizes responsive images anyway. Instead, just find the correct absolute paths, and then hard-code the images in.

Or use the image-uploader on all the images (or use the wp-get-attachment-image function): at least then one can expect a consistent output.