Different atoms, due to different arrangement of electrons, absorb (and emit) different frequencies of light. The light that is emitted can be made to produce patterns (spectra)
and this can be used to identify the actual atoms involved.
Essentially, you shine white light through some atoms in the gaseous state, and observe how the light gets affected. The picture formed by the light (spectrum), then tells about
the structure of the atom itself. It is the electron arrangement inside the atoms that actually absorbs the light when it passes through
Triangular Glass Prism
This is a triangular piece of solid glass that is used to separate (disperse) light into different directions thus making it possible to view each
frequency separately. Otherwise all the frequencies of the light will overlap, and cannot be identified individually. In other words,
this prism refracts the light into separate directions.
Shine ordinary light
Continuous Spectrum
Here light is shone directly through the prism, and a
Continuous Spectrum is formed.
Shine ordinary light, first through HOT gas.
Line Emission Spectrum

Since the light is affected (changed) because it went through the hot gas first, the spectrum produced is different. Most of the light has disappeared! They have actually been absorbed by the atoms
of the gas!
Just a few lines are produced, hence this is called a
Line Emission Spectrum
This is like a bar-code. Each gas through which the light passes, produces a unique pattern. So these patterns can be used to identify an unknown gas!
Shine ordinary light, first through COOL gas.
Line Absorption Spectrum

Most of the spectrum is still there, just a few lines are missing. These lines of colour (frequencies) have been absorbed by the gas, leaving the rest to come through to the prism. And hence
form this pattern. This is called a
Line Absorption Spectrum .