The lines in the spectra occur at wavelengths corresponding to photon energies exactly equal to the spacing of two energy levels in the emitting or absorbing atom. Different atoms have different lines because the spacings of their energy levels are different.