What causes dark gaps or lines to appear superimposed on a star's continuous spectrum?

Answer

Cooler gases in the star’s outer layers absorbing specific wavelengths

Absorption lines occur when photons interact with electrons in the star’s outer layers of cooler gas; the atom absorbs photons only if they possess the exact energy needed to bump an electron to a higher energy level.

What causes dark gaps or lines to appear superimposed on a star's continuous spectrum?

#Videos

How Do We KNOW What Stars Are Made Of? - YouTube

Spectroscopylightastronomycompositionstars