City officials say the new regulations are meant to ensure older people in the city get enough support, including government services, benefits and family support.
Chinese culture puts a heavy emphasis on respecting elders. And China's elderly population is growing.
Shanghai's legislation is inspired by a national law that focuses on the elderly population's well-being.
While the national law requires children to care for aging parents, it doesn't say what punishments will be handed down for failing to do so.