A body floats or sinks in a liquid depends on the difference in their:
Densities
Whenever a body is immersed in a liquid, it experiences an upward force. The magnitude of this upward force depends upon the density of the liquid.
So, it is the difference in density of body and fluid that determines whether the body floats or sinks.