the absorption line spectrum of magnesium

Atomic absorption spectra, such as the one shown here for magnesium, contain distinct lines. What is the cause of these lines?