Coding responsive images the correct way

Hi there! I've always wondered what the correct is to code responsive images on a website, in containers and other elements.

Either something that can fit different image sizes and still make sense layout wise or make the code clean and logical.

I've tried learning the correct way as I never feel quite satisfied. Like having the image percentage wise of the container, having a set px size and other methods.
(It doesnt help that every website do it way different)

I would like to know the "best" way of doing it if possible, thank you!
Was this page helpful?