A high-resolution spectrum of the Sun shows many, many, MANY dark absorption lines: Solarspec RadianceLuxAdded by RadianceLux Absorption lines are based on the same physical principle as emission lines: they involve an atom jumping from one particular energy level to another. In this case, however, the jumps must be upwards, from a low level to a higher one. For example, if a photon of wavelength 121 nm happens to fly past a hydrogen atom in its ground state, the hydrogen atom will absorb the photon and hop up to the n=2 level. That means that if we look at a source of continuous radiation through a cloud of hydrogen gas, we will see a dark absorption line at 121 nm.
We see absorption lines in the spectra of ordinary stars like the Sun because the tenuous outer layers of the stellar atmosphere -- called the photosphere -- absorb some of the continuous light coming from the hot, dense interior.
The conditions needed to produce line spectra
Emission and absorption lines can tell us a great deal about a distant celestial source, but they only occur under certain conditions.
Emission lines from an element will appear if there are atoms of the element present the atoms are in a low-density gas the atoms are excited into a particular high energy level by some external source Absorption lines from an element will appear if there are atoms of the element present the atoms are in a low-density gas the atoms spend most of their time in a particular low-energy level the gas lies between us and a source of contiunous light (of all wavelengths)