When light passes through an atom it provides a burst of energy, and if the amount of energy provided is enough, an electron will use that energy to move into a better seat. In doing so, it absorbs the light, preventing it from passing through the material.