Atoms have electrons "orbiting" them. The electrons can only have specific energies.
If you don't do A-level physics then let me know, because I'm going to assume a couple things.
For example, the lowest possible energy for an electron in a hydrogen atom is -13.6 eV*, and the second lowest possible energy is -3.4 eV. It is impossible for an electron in a hydrogen atom to have an energy of, say, -5 eV. If an electron is in the ground state at -13.6 eV and you give it 5 eV of energy from a laser or some other light source, nothing will happen. If you give it exactly 10.2 eV (the difference between -13.6 and -3.4) then it can go up into the next energy level - meaning that it has absorbed a photon of that very specific energy. As long as the energy it receives exactly fits the difference between the energy levels of the electron, it will absorb it. So there are specific lines in the electromagnetic spectrum that it will absorb.
What about emission? Well, it's the other way around. If the electron starts off in the electron with more than the minimum possible energy, it could climb down a level and reduce its energy. That energy has to go somewhere though, so it emits a photon of light with energy corresponding to that difference.
*the minus sign is convention - you'd have to put in 13.6 eV of energy to fully ionise it.