It certainly does work for responsive. Responsive is what it is all about! It solves most tricky box layout problems that have vexed web developers from the start. It makes centering and space distribution a snap.
The link above makes a good demo. Resize your browser window, and you will see it is responsive.
If you do use flexbox css, you should lose the archaic inline styles, align attributes, etc.
BTW, alert for debugging is a bad idea. Use console.log(). alert() stops the execution of your code, and can cause great confusion when debugging.