HTML % units work in previews but not in topics

Summary

Percent units work in the topic preview while writing a page but don't work in actual topics. Percent units aren't necessary, though having the preview show what the topic actually looks like would be nice.

Repro

Make a HTML img like this in a topic:

![](upload://cl2vsphqCy9SarvXpfwasXWGo13.png)
This image takes up 80% of the parent element width in the preview. However, once posted, the image’s width is 80 pixels, instead of 80% of the parent element’s width.

Example

![](upload://cl2vsphqCy9SarvXpfwasXWGo13.png)
The preview of this article:

example-of-preview

I was able to reproduce this at try.discourse.org. So you might want to report this as a bug to meta.discourse.org

Hold on, when I tested it, system later edited it so it fits correctly. Are you able to confirm this?

It looks like the system switched the image to markup: <img src="![e0e38e3d39403458bdf0513979b05e85ed586107](upload://7wUm0FRBbLJeVBcvTFQTE0LZWnV.png)" width="80%">![](upload://w5sujUGz18XTKzYQYFgIIIZRxIP.png)
I haven’t ever seen Dev Forums do this. It also changed the image size to the actual image resolution (which caps when it gets larger than the parent element).

1 Like