What forms when magma cools and hardens?
If the magma cools under the surface of the earth it forms granite. If the magma cools on the surface it forms lava beds.
Magma is liquid rock. The liquid rock will turn to solid rock as it cools. The speed and location of where and how the liquid cools determines what type of rock will be formed.
If the magma cools slowly underneath the surface of the earth it forms granite with relatively large crystals. If the magma cools rapidly on the surface of the earth the rock forms what is called lava. The crystals are much smaller and harder. An extreme example is obsidian or volcanic glass where the crystals are so small that the crystals look like glass.