In general, when a pure substance or mixture goes from liquid to solid, the molecules in it get closer resulting in a higher density.
If this is so why does ice float in water?
water and ice are special. when water freezes instead of contracting it expands. that is why if you leave a glass of water out in the cold it will burst. so therefore when water becomes ice it has a lesser density. so that is why it floats on the more dense substance -- water.