Why do you float in water but not in air when the gravitation is the exact same?

The air is less dense than your body, so you sink through it. The opposite is true for water, which is more dense than your body, so you float in it.