responsive images with srcset/sizes – width attribute overwrite
-
Dear All!
Today I’ve learned about responsive image loading with srcset and sizes attributes in img tags. Awesome stuff ?? Implemented it right away in one of my pages. Now I’m running into the following problem:
srcset and sizes attributes are populated correctly thanks to add_image_size and wp_calculate_image_sizes. But the img tags are also populated with width and height attributes and these break the expected behavior: the images are displayed in the size specified by the width and height attributes. When removing the width and height attributes with javascript (oh bad!), everything works just fine. I guess this is not the intended way to work this.
Anyone can point me in the right direction?
Thanks in advance
Much love
Henry
- The topic ‘responsive images with srcset/sizes – width attribute overwrite’ is closed to new replies.