(Original post by 2cool)
I know it has something to do with excitation of electrons and them leaving gaps ... but uhh thats about it :/
The light from the star is "white" and passes through the cooler outer layers of the star's atmosphere.
As it passes through, certain wavelengths are absorbed by atoms in this atmosphere corresponding to the energy levels in these gas atoms.
The electrons in these atoms are excited by light photons that have just the right amount of energy to get them to a higher level.
After a short time the atoms re-emit the light as the electrons return to their lower energy levels.
However, they re-emit the light in all directions (not just towards the observer) thus reducing the amount of light of that wavelength travelling to and reaching the observer.
The observer sees this as dark lines in the spectrum of light from the star. These are the "missing" wavelengths characteristic an absorption spectrum.