An atom is
made up of a positively-charged centre known
as a nucleus, around which orbit negatively-charged
electrons. The nucleus contains both positively-charged
particles (protons) and neutral particles
(neutrons). If the number of protons in
the nucleus matches the number of negatively-charged
electrons in orbit around it, then the whole
thing is electrically neutral.
But, if you heat an atom up, the electrons absorb some of the heat energy. What happens when you heat the atom...? Well, just like people...when they get hotter, they start to strip!
How can the wavelengths of light be so closely matched with a particular atom or ion?
When an electron jumps from an orbit with low energy to an orbit with higher energy, energy is absorbed by the atom. This produces the dark (absorption) lines in a spectrum (see animation below). When an electron jumps from a higher to a lower orbit, light with a particular wavelength is emitted (see animation below). Since the energy levels in each atom or ion are different, but very well-defined. Since these energy levels determine which wavelengths can be absorbed or emitted, each atom or ion has its own set of spectral lines - its fingerprint.