Three states of matter
Three beakers containing ice, water and air (water vapor).
Matter can exist in its form because of interatomic and intermolecular forces. In the case of liquids and gases the interatomic forces are weak and hence do not hold atoms in fixed positions as in solids.
The atoms that constitute a molecule of the liquid or gas remain at fixed positions relative to each other within a molecule. But the molecules change their positions freely within the liquid or gas, more so in a gas. This gives both liquids and gases the ability to flow, a property that solids do not have. Due to this property, liquids and gases are also known as fluids. Liquid takes the shape of its container because the molecules of the liquid are not confined to fixed positions as in solids but can move freely from position to position by sliding over one another. Molecules of a liquid are close together and greatly resist compressive forces. Liquids, like solids, are hard to compress, where as gasses are easier to compress.
Since constituents of fluid, such as atoms or molecules, are not held tightly by their neighbours, fluids have to be held in containers. Liquids take the shape of the container, whereas gases "expand" to occupy the entire volume of the container.