When it reaches the same temp. Such conditions are said to be stable and lead to the formation of stratiform clouds if the rising air does not reach the dewpoint. If however the surrounding air is relatively cold a rising parcel of air may remain surrounded by colder air and continue to rise. The conditions are unstable and result in cumuliform clouds. The rising air may even accelerate, especially if it reaches the dewpoint and condensation occurs.
Warm air moving over cold land, by contrast, is stable and frequently produces low stratus cloud.
An inversion is a layer where temperature increases with height, so inversions are layers of extreme stability. They often cause the upward growth of clouds to come to a halt. Stratocumulus and altocumulus often arise when cumulus clouds encounter and inversion. These are clouds formed by forced uplift over hills or mountains. The cloud type depends on the stability.