Gases in the atmosphere, such as carbon dioxide, trap heat similar to the glass roof of a greenhouse. These heat-trapping gases are called greenhouse gases. During the day, the Sun shines through the atmosphere. Earth's surface warms up in the sunlight.