EF lenses can be mounted on cameras with an EF-S mount, but the reverse is not possible. Both, the EF and the EF-S lens mount have the same flange focal distance (44 mm). EF-M mount cameras have a shorter flange focal distance (18 mm), but EF and EF-S lenses can be mounted with an adapter.
Recommended links: camera labs, Canon digital learning center (pdf), Petapixel, Wikipedia (EF mount), Wikipedia (EF-S mount), Wikipedia (EF-M mount)
Blog posts: Macro tilt-shift & EF-S mount incompatibility