When elements are heated/energized their electrons then absorb the energy and transition into a higher energy level known as the excited state. Then electrons then eventually fall back to their lowest state of energy or their ground state.
hope this helps :)p