This is a visualization of the sun's spectra. The dark lines are how we know what the sun is made of through spectrum analysis. Yes, there are holes in the rainbow!
...but a short version is that different atomic elements will absorb different frequencies of light. These directly correspond to the electron shells of these elements. So in these specific wavelengths of light there will be less light that makes it to earth because a percentage of the light has been absorbed by different the outer layers of the sun.