In order to float in a liquid, a solid object must have a lower average density than the liquid. Many types of material are naturally less dense than the most common liquid, water, and so will naturally float; these include most kinds of wood and many plastics. Most metals do not float in water, but boats and ships can still be built out of them by including large cavities, filled with air or some low-density material such as synthetic foam or cork, to reduce the average density of the vessel to less than that of water. However, if water should ever leak into these cavities and displace the air or permeate the foam, the vessel is likely to sink.
Each chemical element has its own particular density, or more than one if it has several allotropes. Solids are not necessarily denser than liquids; at room temperature, liquid mercury is denser even than solid lead, which floats in it. The densest element is osmium, a metal which is solid at room temperature and does not float in any known liquid.