How can i make images stay inside the container (div) when resizing the window?

I’ve created a horizontal div. i’ve put 4 images inside it but when i resize the window, the div resizes accordingly, however the images resize but don’t stay inside the div.

On HTML, i’ve got a div tag and inside it, i’ve got 4 different images. On CSS all images and the container have position “relative” and i edit their properties (width, height, top etc.) using percentages but the images still don’t stay inside the container when resizing the window.

you will need to share some code to go with your description