The temperature of something is the average amount that the atoms in that thing are moving. Space is almost a perfect vacuum and so there simply aren’t enough atoms in a given volume of space to contribute enough movement to raise the temperature any significant amount.
The light of the sun travels through empty space and when it hits something the energy contained within it causes the atoms of that object to move around. As the air is less dense than the ground most of that energy makes it all of the way to the surface of the planet. That heat then radiates upwards from the surface into the surrounding air. This is why temperature drops as you go higher up despite you technically getting closer to the source.
Latest Answers