Most galaxies have spectra dominated by the combined light of all their stars. Because the stars have absorption spectra, so do these galaxies. Also, the absorption lines are broadened by internal motions in the galaxies. In some galaxies, the interstellar gases are glowing brightly. This happens in galaxies with lots of star formation.
Stars form in cocoons of gas and dust.
Newborn stars illuminate the surrounding gas with ultraviolet radiation. This UV radiation ionizes the gas. Ionized gas glows brightly as the atoms recombine. The glow occurs at special wavelengths also. These show up as emission lines in the galaxy spectra.