image credits: Lawrence S. Anderson-Huang, The University of Toledo; image source
The continuous spectrum with dark absorption lines, which is shown twice above, is sunlight, and the emission lines, in the other spectra, are from the elements indicated--magnesium, hydrogen, and sodium. For the difference between absorption lines and emission lines, see the diagram in Continuous, Emission and Absorption Spectra and also in Solar Spectrum.
Can you match any of these emission lines to absorption lines in the solar spectrum? For a simulation of the spectra of many common elements, see Spectra of Gas Discharges.
(This feature was updated on July 27, 2011.)
Spectral Lines, from Physics 2000, and the pages that follow it show how observations of spectral lines led to the concept of atomic energy levels. For more on energy levels, see Ohio State's Measuring Light: Spectroscopy. To find out how stars are classified by their spectral type, visit the Sloan Digital Sky Survey's Energy Levels of Electrons.