Matter is made up of atoms and molecules. The forces which act between them are responsible for the structure of matter. The interaction forces between molecules are known as inter-molecular forces.
When the separation is large, the force between two molecules is attractive and weak. As the separation decreases, the net force of attraction increases up to a particular value and beyond this, the force becomes repulsive.
At a distance R = R0 the net force between the molecules is zero. This separation is called equilibrium separation. Thus, if inter-molecular separation R > R0, there will be an attractive force between molecules. When R < R0, a repulsive force will act between them.
In solids, molecules are very close to each other at their equilibrium separation (10–10 m). Due to high intermolecular forces, they are almost fixed at their positions. That is why a solid has a definite shape.
In liquids, the average separation between the molecules is somewhat larger (10–8 m). The attractive force is weak and the molecules are comparatively free to move inside the whole mass of the liquid.
In gases, the inter-molecular separation is significantly larger and the molecular force is very weak (almost negligible). Molecules of a gas are almost free to move inside a container. That is why gases do not have fixed shape and size.