This is all because of molecules. Molecules are tiny particles which make up every solid, liquid or gas. They can't move about. This is why solids have a definite shape. This means that there is no definite shape.
Liquids take the shape of their container.
Gases spread out to totally fill the space they are contained in. Although the molecules in a liquid are quite close together there is more space between them then in a solid. We can prove this by dissolving sugar in an already full cup of water. Gently place a teaspoon of sugar in the water. If it's cold it might take longer to dissolve.