Ships float because they have less density in the water than the water that they displace. That is why we rate vessels as to their displacement tonnage. The Naval Ratio is 1:3.
1/3 of the vessel height is below the water line, 2/3 above it. 2/3 of the vessel weight is below the water line, 1/3 above. That gives vessels stability and floatation.
Actually, Libyan naval vessels don't float. The ocean gets so disgusted with them that it pushes them out a set distance.