Elevation affects local climate. As elevation increases, temperatures become cooler. This has to do with air density, or how close or far apart air molecules are from each other. Air molecules are held together by gravity. The higher up you are, the harder it is for gravity to hold them together. At higher elevations, air molecules are spaced farther away meaning the air is less dense. The air is less able to trap heat from the sun, so temperatures are cooler. At lower elevations , air molecules are closer together, meaning the air is more dense. The air is better able to trap heat, so temperatures are warmer.
Air density affects temperature. Air at a high elevation is less dense so it cannot hold heat. Air at low elevation is super dense so it can hold heat.