There are continuous spectra, emission spectra, and absorption spectra. Dense materials, such as the deeper parts of our sun, have continuous spectra. Hot, low-density gases have emission spectra (a black spectrum with bright lines in it). The continuous spectrum generated deep in our sun passes through the cooler and lower-density outer regions of the sun, where it is partially absorbed. The result is an absorption spectrum: a rainbow with certain dark lines notched out of it: http://en.wikipedia.org/wiki/Absorption_spectrum
A good way to think about this is that a line spectrum comes from individual atoms, which are quantum-mechanical. In systems with a very large number of particles, the quantum-mechanical behavior becomes undetectable. A dense gas, such as the deeper parts of the sun, has all its atoms so close together that they act like one big object with a very large number of particles. Therefore you get no quantum-mechanical features, and it's just a continuous spectrum.