By design: a pixel width or height in a style passed to getHtml() is taken out of the style, used to resize the image, and emitted as width and height attributes, so a 3000-pixel file is not downloaded to show at 300. Values in other units stay in the style. Resize explicitly with getResized() and style the element with a class.
Answer
Images
An inline width style disappeared from the rendered image tag
More in Images
- The first visitor to a page waits noticeably longer than the second
- An image URL with resize parameters returns the original size
- Images from the old site did not come across during migration
- A grey placeholder box appears on production
- My image came out as a picture tag with sources I did not ask for
Was this page helpful?
Your answer goes to the docs team.