Families should ban phones at bedtime and keep them away from the dinner table, according to the first official advice on social media and screen use from the UK's top doctors.

The guidance, published by the chief medical officers, also warns parents that they should never assume a child is happy to have their photo published online.

The advice forms part of a "precautionary approach" by officials, following an independent review on the effect of screen and social media use in children and young people.

The chief medical officers said there is insufficient evidence to recommend an optimal amount to spend online, but suggest parents set boundaries to ensure a healthy balance.

Professor Dame Sally Davies, chief medical officer for England, said: "Time spent online can be of great benefit to children and young people, providing opportunities for learning and skills development, as well as allowing young people to find support and information.

"But we need to take a precautionary approach and our advice will support children to reap these benefits and protect them from harm."

The chief medical officers have also called for action from technology companies, backing the establishment of an industry duty of care and a voluntary code of conduct.

Measures to protect children online could include introducing clearer terms of conditions, improving age verification, and sharing anonymised data for scientific research to help improve understanding of the effect of screen time on young people, they said.

"It is imperative that the technology industry proactively acts in the interests of users, as well as shareholders," a report by the medical officers states.

Some research included in the review, which was carried out by a team at University College London, has found a link between those who use screen-based activities more frequently and over longer periods and mental health problems.

But it is not possible to determine if screen time can cause these issues.

The chief medical officers - Dame Sally, Dr Catherine Calderwood for Scotland, Dr Frank Atherton for Wales and Dr Michael McBride for Northern Ireland - said their advice addresses societal concerns, with tips including leaving phones outside of bedrooms at bedtime and screen-free meal times.

Parents are also being encouraged to talk about sharing photos and information sensibly online with their children and lead by example when it comes to screen use.

Shirley Cramer, chief executive of the Royal Society of Public Health, said: "Barely a day passes without yet more concerning findings regarding the potential harms around screen use or social media.

"This advice is therefore a step in the right direction towards the establishment of much needed clearer guidance which parents are crying out for to protect their children and help them navigate the Wild West of the digital world."