When does a body float in a liquid?
When an object is completely immersed in a liquid, weight is acting in the downward direction while the upthrust is acting in the upward direction.
If the object sinks in the liquid, then the weight of the body is greater than the upthrust acting on the object by the liquid. If the object floats in the liquid, then the weight of the body is less than the upthrust acting on the object by the liquid.
When the density of the object is less than the liquid the body floats.