The default value for flex-wrap is nowrap. That means if objects can't shrink anymore inside the container, they overflow outside of it.

Make sure to pick nowrap.