Ships float due to the relationship between two competing forces. Gravity pulls the ship down due to its weight. Buoyancy is an upward force acting on the ship when it is put into water.
Whether something floats or not is due to its density, which is how much it weights in relation to its volume. Materials less dense than water will usually float.
Ships are usually made from steel, which is denser than water. They work due to something called displacement. When you get into the bath, the water level rises. This is because it has to make room for you. This is called displacement. A ship’s hull is shaped a certain way to displace enough water to support its own weight.
For a more in depth answer, please visit the following link:
For those that like to learn through play