This image (hi-res version) shows sunlight spread out according to its color like the text in a page of a book (moving from left to right across the page, and then dropping down to the next line). The many dark vertical strips are absorption lines in the sun's visible spectrum. These lines are produced by atoms in the outer part of the sun, which absorb energy selectively. To find out more, see Atomic Absorption and Emission Spectra.
Analysis of these lines determines the chemical composition of a star. To learn more, visit Spectra.