The image element outputs the height attribute with decimals (not valid under the HTML spec) when retina option is turned on and the height of the uploaded image is an odd number

Hi,

Like the title says.

For example, when I upload an image 1200px x 675px (popular 4:3 ratio and size), the image element of the PRO builder outputs something like:
<img src="https://mydomain/wp-content/uploads/2022/11/turquesa.jpg" width="600" height="337.5" alt="Image" loading="lazy">

As you can see, a value with decimals (337.5 in this case) is given to the height attribute which is not a valid value as the spec says it must be an integer.

I suppose it also happens when the width of the uploaded image is an odd number, though I haven’t tested it.

I suppose that the solution is to round the resulting values of the attributes height and width when the retina support option is active.

Tested on a clean installation (I enclose the credentials on a secure note).

Thanks!

Hey Diego,

I have replicated the issue you described. Regretfully, there’s no workaround but to use even PX image to output an integer.

I’ll post your suggestion in our issue tracker so that our development team will know.

Thanks.

Thank you Christian!

You’re welcome, Diego.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.