Normally, the higher the altitude, the lower air temperature, and vice verse. Because solar energy is converted to sensible heat at the ground, which in turn warms the air at the surface.
Temperature inversion occurs when a layer of warm air aloft acts as a lid above a layer of cold air. The colder, denser air close to the ground does not readily circulate (mix). Pollutants such as carbon monoxide and particle pollution and ozone-producing hydrocarbons are “trapped” in the cold air by the lid. The quantity of pollution tends to increase until the lid is destroyed by heating or by wind.
There are two types of temperature inversions: surface inversions that occur near the Earth's surface, and aloft inversions that occur above the ground. Surface inversions are the most important in the study of air quality.