When an electron of an atom absorbs a photon, it changes goes up to a higher energy orbital.
When an electron falls to a lower energy orbital, it emits a photon with exactly the amount of energy released from the electron falling in state.
In other words, the absorbance/emittance of atoms can only happen at very specific amounts of energy, one for each possible difference of orbitals(possible places the electron can be in the atom)
Here are all the possible places an electron can be. It's the periodic table!