Why dead bodies float on water?

A body floats due to the gases left in the body, once the gases dissipate the body sinks until it produces more gas to float.