Cotton in solid but it floats on water. Why?

Cotton in solid but it floats on water. Why?

Cotton has large number of pores, in which air is trapped. Hence reducing its density and increasing the volume. Therefore cotton floats on water. But when these pores get filled with water it starts sinking.