Junk food advertising is to be banned across all children's media - including online and social - in a landmark decision to help tackle childhood obesity.
The new rules will ban the advertising of food or drink high in fat, salt or sugar (HFSS) across all non-broadcast media targeted at under-16s from July next year, the Committee of Advertising Practice (CAP) said.
The changes bring media such as print, cinema and, crucially, online and social media, into line with television, where strict regulation prohibits the advertising of unhealthy food to children.
They ban ads that directly or indirectly promote an HFSS product from appearing in children's media or other media where children make up more than 25% of the audience.
The new restrictions also apply to TV-like content online, such as on video-sharing platforms or 'advergames', if they are directed at or likely to appeal particularly to children.
A ban on companies using promotions, licensed characters or celebrities popular with children in ads for HFSS food or drink will be partly lifted for the advertising of healthier options.
Shifting media habits among young people and evolving advertising techniques had fundamentally changed children's relationship with media, CAP said.
The "significant" change would help protect the health and wellbeing of children and lead to a major reduction in the number of ads for HFSS food and drinks they see, said the organisation, which is responsible for writing and maintaining the UK advertising codes.
Ofcom's latest figures show that young people aged between five and 15 now spend about 15 hours each week online, overtaking the time they spend watching a TV set.
CAP chairman James Best said: "Childhood obesity is a serious and complex issue and one that we're determined to play our part in tackling. These restrictions will significantly reduce the number of ads for high, fat, salt or sugar products seen by children.
"Our tough new rules are a clear demonstration that the ad industry is willing and ready to act on its responsibilities and puts the protection of children at the heart of its work."
Jenny Rosborough, campaign manager at Action on Sugar, called for restrictions to be extended to programmes such as X Factor, which are hugely popular with children but exempt from restrictions because they fall outside children's programming.
She said: "We welcome the news that CAP are banning the advertising of high fat, salt or sugar food or drink products in children's non-broadcast media. We know that advertising influences children's food preferences.
"However, we need to see bans on advertising go further, as they currently do not manage exposure to these adverts during popular family programmes such as the X Factor or Britain's Got Talent.
"Levels of obesity and type 2 diabetes are worryingly high and everyone has a role to play."
Food and Drink Federation director general Ian Wright said the group "fully supported" the new rules.
"UK food and drink companies have a high compliance rate with advertising rules. Our job now is to work with the Advertising Standards Agency, Advertising Association and other partners to make sure advertisers understand how to meet these new requirements which represent a major shift in the UK advertising regime."
The Obesity Health Alliance, a coalition of more than 30 charities, Royal Medical Colleges and campaign groups, said: "We welcome CAP's long-awaited rules to protect children from junk food marketing across all types of media and are pleased to see them recognise that restrictions should apply to kids up to the age of 16.
"But it's concerning that the new restrictions only apply when it can be shown that at least 25% of the audience are children. This loophole means that a significant number of children could still be exposed to adverts for high fat, salt and sugary products.
"Research shows advertising greatly influences the food children choose to eat, and with one third of children overweight or obese by their 11th birthday, we need to protect them from relentless junk food marketing in all walks of life."
Children's Food Campaign co-ordinator Malcolm Clark said: "CAP has finally listened to the voices of parents and health professionals, after years of resisting calls for stronger measures to reduce children's exposure to junk food marketing online.
"The new rules, which prohibit less healthy food and drink being advertised across all forms of children's media, are a positive step and go some way to removing the most blatant forms of such advertising to under 16s."
But Mr Clark also raised concerns that the 25% of the audience rule provided insufficient protection to children and gave parents little knowledge of what will or will not be covered.
He said: "Ultimately, the new rules are only as good as the body which enforces them. We hope that CAP and the Advertising Standards Authority will ensure companies follow both the letter and the spirit of these new rules, and close any loopholes which arise."
Professor Neena Modi, president of the Royal College of Paediatrics and Child Health, said: "This is another positive step forward in the fight to tackle the rising prevalence of overweight and obesity in children, and the damaging health effects of junk food and fizzy drinks.
"Children are influenced a great deal by advertising. There are shows which are not specifically targeted at children, that draw in thousands of children every week, and often have fast food adverts shown multiple times over the course of the broadcast.
"With over a fifth of children in the UK overweight or obese when they start primary school and a third by the time they reach Year 6, surely it is time for Government to strengthen rules around all advertising, and in particular ban the advertising of foods high in salt, sugar and fat on television before the 9pm watershed."
A Government spokesman said: "We are committed to tackling childhood obesity and it is encouraging to see industry playing its part by taking action to reduce advertising of high fat, salt or sugar food or drink products in children's media.
"This is an important step given children are increasingly turning to digital channels of communication. It complements our world-leading plan to reduce childhood obesity, backed by the Soft Drinks Industry Levy and Public Health England's sugar reduction programme. We are making real progress in this area, but there is still more to be done."