We can have a better understanding of our surroundings when we go back to the basics. We can start with the commonly known states of matter.
Firstoff, let's recall what matter is. As we normally define it, matter is anything with mass and that which occupies space. To have a better understanding of the states of matter, let's use ice cubes as an example.
Ice cubes are solid (first state). When they melted, they turned to water (or liquid, the second state). If we apply heat to water, it will boil and eventually evaporate (turn to gas, the third state). Now let us look deeper.
Solids have molecules arranged so packed and closed together. The forces holding each molecule are too strong, thus impeding molecules to move freely. That's why solids have definite shapes and volume.
We know that ice cubes melt when the temperature rises. The application of heat breaks the forces that hold the molecules, allowing them to move. This is the reason liquids flow. We can still retain the same volume as the ice cubes, but the shape changes. Liquids are known to copy the shape of the container they are poured into.
If we continue to apply heat, and if we reach the boiling point of water, evaporation now occurs. Heat further breaks the forces holding the molecules, making them move outrageously to every available space they can go. This is the reason gases has no definite shape and volume.
I hope you have a better understanding now of how molecules of solids, liquids, and gases behave.