In your example, .container
has a fixed width of 500px, and the child images has a width of 100%, so the image will scale to fit the parent container. However, since .container
has a fixed width, it will not change as you shrink or expand the window.
As you observed, for the case of .container2
with a percentage width that will respond to the window width, the image will re-size accordingly.
You are seeing the correct behavior, so the short answer to your question is no, at least for the layout that you are looking at.