A boat floats, because the fluid in which it is floating offsets the downward pull of gravity and pushes it up. The scientific name for this force, which allows even immense objects to float in liquid, is buoyant force , more commonly known as buoyancy . A solid object's density determines whether or not the buoyant force of a liquid can lift it. The density of an object depends upon its weight and its size. Given two solid objects that are different sizes, but weigh the same, the smaller, more compact object is the denser of the two.
Fluids also have density.
When an object is placed in the fluid, it pushes aside some of the liquid and, if its density is greater than that of the fluid it displaces, it will sink and, if not, it will float. Despite the enormous size of some ships, they are basically metal shells filled with air, and are less dense and lighter than the water they push aside, which allows the boats to float.