No, no it wouldn't. It would be more effective to stop subsidizing unhealthy food. The long-term effects of such legislation are almost guaranteed to be a net-negative because of edge cases. There are already way too many laws. You should always look first at what can be removed, rather than what can be added.
No, what would be effective is if the parents of children stopped letting 'em eat junk food all the fricking time. "Mummy, I want a Snickers". Bad fricking luck, kid, eat your fricking vegetables.
It's somebody else's issue, and I refuse to accept any responsibility or worry over the fact that somebody else's kids are fat. I have enough problems of my own, I've got better things to do than accept part-ownership of the easily-soluble problems of others.
I believe this has been law here in the UK for some years but the childhood obesity rates are still high. The problem is that the most convenient food in terms of both price and preparation time is the least healthy.