HTML Responsive Images

Hi there, I am new to HTML, however not to discourse.

Does anybody know how I would make an image responsive (change size depending on screen size). I’d like to add an image to a thread, and make it responsive.

Hey, welcome to Meta :wave:

This should already work, On desktop, the maximum width for a post is about 700px. The maximum width for images is set by the max_image_width site setting. It defaults to 690px - to account for some padding. It is very unlikely for anyone to run a desktop browser window smaller than 700px.

On mobile, we give images a width based on the size of the screen. So, images will always fit not matter what phone you use.

You can see how all of this works here

discourse/app/assets/javascripts/discourse/widgets/post-cooked.js at c61ebc9ba67d6588c09c2b93205865e0fd388f51 · discourse/discourse · GitHub

7 Likes